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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Catching error message thrown by a T-SQL, not just the error number @@error

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-21 : 11:01:26
Pankaj writes "Catching error message thrown by a T-SQL, not just the error number @@error

Like in my case when I fired the sql , the got the following error :-

Server: Msg 8152, Level 16, State 9, Procedure SetErrorStuff, Line 14
String or binary data would be truncated.
The statement has been terminated.

I can capture error number by @@error which will be "8152", but I need to capture actual error message "String or binary data would be truncated." This is a static message in this case by we may have other errors like "referential integrity failed, table "aaa" column "bbb" ". In this case table and column names will be significant and just by looking into sysmessages table won't help as it would have "%s" etc in error description in sysmessages table.

Pankaj"
   

- Advertisement -