I have an error handler sproc that issues a RAISERROR statement. I would like for this sproc to write error messages to a table. No problem so far. What if there is a nested transaction with several ROLLBACKs? If the code is only
1 level deep the error handler sproc can write to the error message table after the ROLLBACK. If the code is 2 or more levels deep and an error occurs then what is written to the error message table might get rolled back if an error occurs after returning
to the 1st level. What I thought I would like to do is to have the error handler spawn a sub-process that would record the error message, where the sub-process would not be affected by any subsequent ROLLBACKs in the calling sproc. Thoughts?
View Complete Post