在论坛看到有人执行了一个UPDATE,但是发现错了,问是否可以取消这个更新操作。因为涉及的数据比较多,所以怕取消操作造成数据不一致。

 

其实对于单独的UPDATE操作而言,都是当做一个隐性事务处理的,具有ACID属性,Non或者All.所以不管这个UPDATE会影响多少行,取消操作所有影响的行都会回滚,保证事务完整性。

 

下面的解释来自SQL SERVER 2008 INTERNALS:

 

An implicit transaction is any individual INSERT, UPDATE, DELETE, or MERGE statement. (You can also consider SELECT statements to be implicit transactions, although SQL Server does not write to the log when SELECT statements are processed.) No matter how many rows are affected, the statement must exhibit all the ACID properties of a transaction。