SET XACT_ABORT ON
BEGIN TRAN
……………………………………
……………………………………
……………………………………
COMMIT TRAN
SET XACT_ABORT OFF
In this approach, you don’t need to check @@error and rollback inside transaction, it will automatically rollback the action when error happens.
No comments:
Post a Comment