Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nivaskhan
Starting Member
17 Posts |
Posted - 2003-05-23 : 10:56:40
|
| Is there any SQL system function or system procedure by which we can get the error description for an error by giving the error number as input..Please help..Regards,Nivas |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2003-05-23 : 11:06:59
|
| Check out the RAISERROR function. You can pass it a user-defined error number, and it will look up your custom message in the SysMessages table. However, you must add your custom message to the SysMessage table first using sp_Addmessage. Or, if you want a built-in error message, pass that to RAISERROR, with a proper severity and state.Sarah Berger MCSD |
 |
|
|
nivaskhan
Starting Member
17 Posts |
Posted - 2003-05-23 : 11:14:18
|
| sorry guys,i think i confused you all..my question was is there an inbuilt procedure/function to retrive the corresponding error message for an error number.let me give u an example...error number <b>"104"</b> corresponds to <b>"ORDER BY items must appear in the select list if the statement contains a UNION operator."</b>is there any way that i can get this message by giving only the err number as input.Regards,Nivas |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-05-23 : 11:17:27
|
| not confused check out nigel's example. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-05-23 : 11:32:07
|
| The example on my web site will give the error message generated with the fields included.To get the error message template you can just go to master..sysmessages.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2003-05-23 : 14:22:16
|
| Not confused either, using RAISERROR with a built-in error number will give you the message of that error.Example:(Call)RAISERROR(21,10,1)(Result)Warning: Fatal error %d occurred at %S_DATE. Note the error and time, and contact your system administrator.Sarah Berger MCSD |
 |
|
|
|
|
|
|
|