Capture THROW details

  • When using the THROW statement, is there a way of capturing the info so it can be written to a table?

  • Can you post the statement where you are using the THROW clause?

  • Sure, in the catch block before you THROW, use the ERROR_NUMBER(), ERROR_MESSAGE(), ERROR_PROCEDURE(), ERROR_SEVERITY() and ERROR_LINE() in an insert statement into the table of your choice.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Gail I'll give that a try.

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

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