开发者

What is SQL Server implict transaction exactly?

开发者 https://www.devze.com 2023-02-13 17:25 出处:网络
What is Implict Transaction. What is scope? W开发者_运维问答hich command included this transaction group?According to the documentation for Implicit Transactions:

What is Implict Transaction. What is scope? W开发者_运维问答hich command included this transaction group?


According to the documentation for Implicit Transactions:

  • You have to specifically enable it for a connection
  • When enabled, every time you COMMIT or ROLLBACK a transaction, a new one is started upon the next command that needs it (there is a list in the documentation)

This means that:

  • When enabled, you always have to COMMIT or ROLLBACK

Your question could also be asking about the difference between implicit and explicit transactions.

Microsoft SQL Server always runs modifications (simplified, there are some things that runs without, like bulk insert) in a transaction. In other words, if you haven't specifically opened a transaction, the following is how every modification is run:

try
    ... modification here (update, insert, delete...)
on exception
    rollback
on success
    commit


any command that you run is part of an implicit transaction , sql server starts an implicit transaction to have the DB in an ACID state, this way it can rollback if there is an error

an Explicit transation is one that start with BEGIN TRANSACTION


Refer these links...

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

http://msdn.microsoft.com/en-us/library/aa213073%28v=sql.80%29.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号