April 30, 2004 at 9:51 am
I believe not but who knows?
I would like to handle the messages to add others informations.
For example, if I have a constraint violation, the error is raised and after that I have the posibility to do something (put the @@error in a local variable and if is non 0 do something etc.).
But the error is already raised and the message printed. I know that what I say is more than obvious for every person who have some experience with SQL Server. I still try and ask if there is any posibility to update the message before the error is raised.
Thanks.
May 3, 2004 at 8:00 am
This was removed by the editor as SPAM
May 3, 2004 at 4:56 pm
Try using the T-SQL RAISERROR statement. Using RAISERROR you can return to the client a string in the raiserror statement or a system defined message from dbo.master.sysmessages. You can add messages to sysmessages by using the sp_addmessage system stored procedure. Takes a bit more error handling code in your proc, but well worth it.
Happy Hunting,
Pete
May 4, 2004 at 4:53 am
Finally I did something like that.
FIrst of all I build some tables in which I clasified errors from sysmasters.
I made some views with these custom tables and system and views tables.
After that, after every standard action (which means insert, update etc), i store @@error in a variable and, on the base of that variable like a parameter (and the name of the procedure, the table updated etc) I use a custom raiserror stored procedure.
I had to use for some kind of errors the error description and finally I use the method suggested few days ago (saving in sql server log the description of the error).
I add custom messages and their are the same as those custom error types.
Depends of the error I raise a type or another with the parameters from the stored procedure either constructed in that custom raiserror.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply