SET_XACT_ABORT ON in a transaction with rollback present in catch block

204 views Asked by At

Just going through some tutorials at the moment and I see a lot of code in stored procedures as follows.

SET_XACT_ABORT ON BEGIN TRY .... COMMIT TRANSACTION

END TRY BEGIN CATCH ROLLBACK TRANSACTION END CATCH

Just wondering why would the SET_XACT_ABORT ON here would be necessary as wouldn't any throw or raise error be caught in the Catch block anyway and the transaction will be rolled back?

Thanks

0

There are 0 answers