I have a question regarding the MSDN documentation for TRY CATCH
blocks. Check out this article and scroll down to Example C "Using TRY…CATCH with XACT_STATE"
http://msdn.microsoft.com/en-us/library/ms175976.aspx
The example first places a COMMIT TRANSACTION
within the Try block, and then places a second one in the Catch block if XACT_STATE()=1
.
However I thought a Catch block will only execute in case of an error. So how could both the Catch block execute and XACT_STATE
return 1? That seems contradictory.
There is an unanswered comment within the XACT_STATE
documentation which asks this same question