Tuesday, October 25, 2005

How to roll back transaction completely

If a run-time statement error (such as a constraint violation) occurs in a batch, the default behavior in SQL Server is to roll back only the statement that generated the error. You can change this behavior using the SET xact_abort statement. After SET xact_abort ON is executed, any run-time statement error causes an automatic rollback of the current transaction. Compile errors, such as syntax errors, are not affected by SET

0 Comments:

Post a Comment

<< Home