Catching errors in Tsql

  • I'm a beginner, and I need to know the best way to catch the errors in T-SQl in order to create my own log table, at this stage Ican catch the error Id what I reaally need is the real description: the one that appear in the messages onglet not the one you find in the table sysmessages with the parameters caracter (%)

    thanks a million

  • Not quite sure, but this might be what you are after

    http://www.nigelrivett.net/spFormatOutputBuffer.html

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Hi,

    Thank you for your help, I'm sorry, I'll bother you just one more time

    but can you explain the use of  '26' in this instruction

    insert #b(s) exec ('dbcc outputbuffer(26)')

    Cheers

  • The 26 should be just for demonstration purposes. DBCC OUTPUTBUFFER requires a systemprocess ID as input parameter.

    You might want to take a look at both DBCC OUTPUTBUFFER and SPID in Books Online.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply