Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Get Error Description in SQL Server 2000


Get Error Description in SQL Server 2000

Author
Message
mbenothmane
mbenothmane
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 82
Some error messages are template and need to raiseerror first, check for the error number and get error description, at that point, you will get the target objects (table name, column etc ..) replaced. This applies to some errors, but others you can get the full error message such as divide by zero etc ..

exec msdb..sp_get_message_description 8134


--Mohamed



Mudassar Ahmed Khan
Mudassar Ahmed Khan
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 36
I had a requirement to get the Exact Error Messages generated by SQL Server 2000. If I was not able to achieve that then we would have switched to Windows Service.
Mark Taylor-212571
Mark Taylor-212571
SSC Journeyman
SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)SSC Journeyman (96 reputation)

Group: General Forum Members
Points: 96 Visits: 62
Is it me or are you guys missing a trick here?

There is a system table named sysmessages where all error descriptions are stored (both system errors and user errors), with reference to the place holders you should know for the most part which table caused the error as you should really be checking for errors at every stage of a transaction. With regards to the column this is where my process falls short, you are not able able to capture it real time you would have to re-run the process to find the column that isn't happy.

Once I'm in the office tomorrow I will post the full code I use for all error captures for all my databases. This code allows you to trap the error, record the error message and the details of the process that caused the error and then issue an alert email to the DBA's or whoever you want to send the message to.

The error capture process will store the error details and process details in the database you are working with if for any reason it cannot record the error in the database it reverts to storing the data in the server log. I have to say I'm not a big fan of storing the error in the log as it is more difficult to extract in an automated manor than if it is stored in table where the error occurred or even in a central error capture database.
Mudassar Ahmed Khan
Mudassar Ahmed Khan
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 36
The sysmessage is there but since there are multiple insert stmts and multiple update stmts just looking at the placeholder is very difficult. Since in my case the support IT team required the exact error description so that they can sort the issue as soon as possible. since sys messages give only the template message. for eg Inserting Null value into a column which does not allow it. In our case each table has around 15 - 25 columns. So it would be very difficult to find out looking at the sysmessage that which table the issue has occurred and which value was Null.
Misha_SQL
Misha_SQL
SSChasing Mays
SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)SSChasing Mays (616 reputation)

Group: General Forum Members
Points: 616 Visits: 986
I found both the article AND the subsequent discussion here very useful. Thank you to all!



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search