坑爹的SET XACT_ABORT

begin tran

delete from XX where ...

...

delete from YY where...

commit

你以为执行delete from XX where ...出错 会回滚吧?

其实不会

需要设置

SET XACT_ABORT ON
begin tran
...
commit


才会遇到错误就全部回滚!

你可能感兴趣的:(坑爹的SET XACT_ABORT)