Update query cancelled by user

我是研究僧i 提交于 2019-11-27 18:17:08

问题


I have a table that has millions of rows.

Accidentally I wrote an update query over a table without where clause and clicked execute.

It started executing. After two seconds I realized the query is wrong and I clicked 'Stop' button in Sql Server Management Studio. The query execution was stopped, this all happened within 7 seconds.

Now I am curious to know if there are any rows affected. If any which are they? How to find it?


回答1:


A single update statement will not update some rows. It's all rows or none

This is the atomicity in the ACID properties which SQL server respects well.

Atomicity requires that each transaction is "all or nothing": if one part of the transaction fails, the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes.

Then the commit is at the end of the statement, so when you cancel there's no commit



来源:https://stackoverflow.com/questions/13531818/update-query-cancelled-by-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!