Blog Pages

set XACT_ABORT ON - Rollback when transaction failed

set XACT_ABORT ON
begin tran
...........
insert......
select.....
update.....
...........
commit

If you run it and one or more statements in the transaction will failed - it does ROLLBACK automatically all that was in the transaction. Without it - actions that they can succeed -  succeed and the others will failed.
The default value of XACT_ABORT is OFF, that why we have to activate it.

No comments:

Post a Comment