https://logicalread.com/sql-server-exception-handling-try-catch-throw-mc03/
Good description there on how to write one and that the THROW is necessary within a transaction. I learned something in this because I rarely ever write transactions due to locks being applied while it is running.
On Thu, Sep 13, 2018 at 4:02 PM Malcolm Greene profox@bdurham.com wrote:
Anyone have an example of how to trap and exception within a T-SQL transaction and save diagnostic details on why the transaction failed to an error log? If you insert the exception data to an error table this information gets lost when you rollback the transaction. I'm sure I'm missing something obvious :) Thanks, Malcolm
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]