Tuesday, May 10, 2011

ROLLBACK TRANSACTION


http://msdn.microsoft.com/en-us/library/ms181299.aspx



If a ROLLBACK TRANSACTION is issued in a trigger:
  • All data modifications made to that point in the current transaction are rolled back, including any made by the trigger.
  • The trigger continues executing any remaining statements after the ROLLBACK statement. If any of these statements modify data, the modifications are not rolled back. No nested triggers are fired by the execution of these remaining statements.
  • The statements in the batch after the statement that fired the trigger are not executed.
@@TRANCOUNT is incremented by one when entering a trigger, even when in autocommit mode. (The system treats a trigger as an implied nested transaction.)
ROLLBACK TRANSACTION statements in stored procedures do not affect subsequent statements in the batch that called the procedure; subsequent statements in the batch are executed. ROLLBACK TRANSACTION statements in triggers terminate the batch containing the statement that fired the trigger; subsequent statements in the batch are not executed.

No comments:

Post a Comment