How to make SET XACT_ABORT ON rollback the transaction?
问题 Based on the Books Online documentation of SET XACT_ABORT ON, i get the impression that if a T-SQL statement raises a run-time error, the entire transaction is terminated and rolled back: Remarks When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction is terminated and rolled back. Testing this in SQL Server 2008 R2: SET XACT_ABORT ON; BEGIN TRANSACTION; PRINT 'TranCount befor an error = '+CAST(@@Trancount AS varchar(50)) DROP TABLE QuertyAsdf