SQL Clone
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
Mudassar Ahmed Khan
Mudassar Ahmed Khan
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 36
Comments posted to this topic are about the item Get Error Description in SQL Server 2000
philcart
philcart
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15005 Visits: 1441
Looks pretty familiar.

http://www.sqlservercentral.com/articles/Stored+Procedures/capturingtheerrordescriptioninastoredprocedure/1342/

Hope this helps
Phill Carter
--------------------
Colt 45 - the original point and click interface

Australian SQL Server User Groups - My profile
Phills Philosophies
Murrumbeena Cricket Club
Mudassar Ahmed Khan
Mudassar Ahmed Khan
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 36
Yes I had a look. It is similar to mine. But I have not extracted any thing from it. If I had done so why would I post the article on same site.Smile
Mark D Powell
Mark D Powell
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2496 Visits: 481
I was unable to find sp_GetErrorDesc in the resouce section. Where should (url) I be looking? A search on the procedure name returned no hits.

-- Mark --
Mudassar Ahmed Khan
Mudassar Ahmed Khan
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 36
Its there in the Resources Section There's a link to download the file The File Name itself is the link Text
sp_GetErrorDesc.sql
Search for this sp_GetErrorDesc.sql
Mudassar Ahmed Khan
Mudassar Ahmed Khan
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 36
The URL of the file is
http://www.sqlservercentral.com/Files/sp_GetErrorDesc.sql/2268.sql
SQLBOT
SQLBOT
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3060 Visits: 836
The way I usually do things is to try to check return codes and handle the error at the procedure level...
I code all my stored procs to return specific codes for specific errors.

ex:

exec @ret = mydb.dbo.usp_procedure @arg1='foo'
if @ret = -1
RAISERROR('USP_PROCEDURE FAILED BECAUSE IT WAS TIRED', 16,1) WITH LOG
if @ret = -2
RAISERROR('USP_PROCEDURE FAILED FOR SOME OTHER REASON', 16,1) -- not specifying WITH LOG



What this accomplishes is that you keep your error severity level in the 'user mode' and allows you to be specific with your language when dealing with a specific stored procedure.... it also logs (or doesn't) depending on how you code it.... so for a less critical table, a 515 error might not be "log worthy" if you catch my meaning.

It also enables you to move your database to a different server without as much trouble.

Craig Outcalt



Tips for new DBAs: http://www.sqlservercentral.com/articles/Career/64632
My other articles: http://www.sqlservercentral.com/Authors/Articles/Craig_Outcalt/560258
Mudassar Ahmed Khan
Mudassar Ahmed Khan
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 36
Hi,
Actually I had a need to get Exact Error Message and for Emailing. Since I had to give all functionality that a windows service would do.


Otherwise I would had sticked to Windows Service.
mbenothmane
mbenothmane
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 82
MS SQL 2000 already has system stored procedure in msdb that returns error description from messages table. The system stored procedure is named "sp_get_message_description"



Mudassar Ahmed Khan
Mudassar Ahmed Khan
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 36
I ran sp_get_message_description 515

and the O/P
Cannot insert the value NULL into column '%.*ls', table '%.*ls'; column does not allow nulls. %ls fails.

Can you tell me how to fill out the missing values???
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