How to track all error in the trigger then save those error in a table

  • Hi Everyone,

    Just a quick question hope you can share some light on it.

    How can i track all error in the trigger then save those error in a table (Looks like a auto generated error log )

    Thanks

  • First, remember that no all errors can be trapped in in a TRY/CATCH setup.

    Code your trigger to use TRY/CATCH. For the errors that can be caught, capture the error information to either a set of variables or a table variable. Then issue a rollback for the transaction. After the rollback and still in the trigger, write the information from the variables or table variable to your error table, then return from the trigger.

    Hope this helps.

Viewing 2 posts - 1 through 1 (of 1 total)

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