Hi Everyone!
In my stored procedure I check for any errors during .
If there are any errors I log them. (by checking @@ERROR)
What my problem is, the error message that's been logged contain place holders like %s, %l, %d,etc. along with the error message.
How can I get the full error message, with place holders replaced by real error values/text?
Here is a sample what I get as the error:
* Error ID: 547
* Error Desc: %ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls.
using this query
When I run the stored proc in Query Analyser it gives the actual error message as:
Server: Msg 547, Level 16, State 1, Procedure sp_register_change, Line 366
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_TBL_EQUIPMENT'. The conflict occurred in database 'EquipManT', table 'TBL_EQUIPMENT', column 'unitno'.
The statement has been terminated.
Thanks heaps,
rochana
In my stored procedure I check for any errors during .
If there are any errors I log them. (by checking @@ERROR)
What my problem is, the error message that's been logged contain place holders like %s, %l, %d,etc. along with the error message.
How can I get the full error message, with place holders replaced by real error values/text?
Here is a sample what I get as the error:
* Error ID: 547
* Error Desc: %ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls.
using this query
Code:
SELECT @errdesc=description FROM master.dbo.sysmessages WHERE error = @errid
When I run the stored proc in Query Analyser it gives the actual error message as:
Server: Msg 547, Level 16, State 1, Procedure sp_register_change, Line 366
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_TBL_EQUIPMENT'. The conflict occurred in database 'EquipManT', table 'TBL_EQUIPMENT', column 'unitno'.
The statement has been terminated.
Thanks heaps,
rochana