简体   繁体   English

sql server中的嵌套事务

[英]Nested transactions in sql server

Does sql server allow nested transactions? sql server是否允许嵌套事务? If so then whats the priority of transactions? 如果是这样,那么交易的重点是什么?

From the MSDN documentation on SQL Server. 从SQL Server上的MSDN文档。 Nesting Transactions : 嵌套交易

Committing inner transactions is ignored by the SQL Server Database Engine. SQL Server数据库引擎会忽略提交内部事务。 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. 如果回滚外部事务,则无论内部事务是否单独提交,所有内部事务也将回滚。

Just to qualify this and directly answer the question, yes SQL Server does allow the nesting of transactions. 只是为了限定这个并直接回答这个问题,是的SQL Server确实允许嵌套事务。

The quoted reference kindly provided by ichiban, details that the outcome of outermost transaction will determine whether or not nested transactions are committed. 引用的引用由ichiban友情提供,详细说明最外层事务的结果将决定是否提交嵌套事务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM