June 18, 2004 at 5:55 am
I'm looking for a way to catch the full error-message in T-SQL. The intention is to store this error-message in a history-table, and be able to look through the error-messages at a later stage.
If I run the following query,
select * from foo -- I do not have a table called 'foo'
, then the result will look something like this:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'foo'.
Is there any way to assign the formatted error-message to a local variable? I'm not looking for the master..sysmessage.description-column, as this does not include the (for me) critical information that the error concerned the table 'foo'...
June 21, 2004 at 8:00 am
This was removed by the editor as SPAM
June 21, 2004 at 7:27 pm
There was an article posted recently about capturing the full text of the error message. It involved setting the error to log to the SQL error log and then retrieving the text via a stored procedure.
--------------------
Colt 45 - the original point and click interface
June 24, 2004 at 1:34 am
article: sqlservercentral
I have qualms about it:
* Could be fallible with concurrent processes.
* Can you really limit the errors you want to trap to a subset ?- otherwise you log everything which is an overhead.
The article mentions in passing that another way could be to use sp_OA procedures and SQL-DMO. This sounds better although I havent tried it.
Stupidly its a lot easier to get the detailed error message back in the calling app (eg ADO).
Love the icon Phil. But if you hear your colt go click it aint working.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply