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)
 Returning Error Descriptions from Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-22 : 23:16:23
Diccon writes "I am using the following fairly standard error handling code:

SELECT @intErr = @@ERROR
IF @intErr <> 0
BEGIN
ROLLBACK TRANSACTION
RETURN @intErr
END

in my stored procedures. I would like to also capture the error
description for the error at the same time. Obviously I can look the error number up in sysmessages but this then gives me a further problem.

For example the error message for error 547 is:

%ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls.

The percent sign "wild cards" are vital to understand exactly what happened.

How can I capture the full error description with the wild cards filled in at the time of the error?

Thanks.

Regards

Diccon Spain.

P.S. I am using SQL Server 2000 on Windows NT4 Workstation"

   

- Advertisement -