Rollback the inner transaction of nested transaction

后端 未结 5 1847
天命终不由人
天命终不由人 2020-12-05 02:43

suppose I have following sql statement in sql server 2008:

BEGIN TRANSACTION    
SqlStatement1    
EXEC sp1    
SqlStatement3
COMMIT TRANSACTION
5条回答
  •  有刺的猬
    2020-12-05 03:38

    Committing inner transactions is ignored by the SQL Server Database Engine. The transaction is either committed or rolled back based on the action taken at the end of the outermost transaction. If the outer transaction is committed, the inner nested transactions are also committed. If the outer transaction is rolled back, then all inner transactions are also rolled back, regardless of whether or not the inner transactions were individually committed.

    Nesting Transactions in Microsoft TechNet

提交回复
热议问题