Is possible to capture the message of error generated in the execution
of a command SQL?
Thanks.DECLARE@.Error
..sql statement
SELECT @.Error = @.@.ERROR
SELECT *
FROM master..sysmessages
WHERE error = @.Error|||I thank its reply, but I want to capture the specific message of the error and not it generic message. For example:
"Cannot insert the value NULL into column 'field1', table 'DB.dbo.Tab'; column does not allow nulls. INSERT fails."
instead of :
"Cannot insert the value NULL into column '%.*ls', table '%.*ls'; column does not allow nulls. %ls fails."
DECLARE@.Error
..sql statement
SELECT @.Error = @.@.ERROR
SELECT *
FROM master..sysmessages
WHERE error = @.Error
No comments:
Post a Comment