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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-04-08 : 09:14:18
|
| Les Corbett writes "I want to be able to take the message displayed by RAISERROR and put it into a variable so as to store it into an attribute of a table.I do not know what the error message is going to be. I must be able to trap any error and put the message and code into the attribute of a table.the description from sysmessages is not good enough, I need the messgae displayed from RAISERRORThanks for any help" |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2004-04-08 : 11:20:43
|
| You can use Raiserror to return a user defined error message and sent back to the client as a server error message. If you want to return the default error message the use @@error.Select * from sysmessages where error = @@errorCheck BOL on topic Raiserror, sp_addmessage, @@ERROR.- Sekar |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-04-08 : 12:43:27
|
| I prefer to build a dynamic error string for my raiserror message. When you do the raiserror, you can insert table(string, errornumber) select @string, @@error, then raiserror(@string,16,1).Is that what you are looking for?MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|