用户取消更新查询 [英] Update query cancelled by user

查看:30
本文介绍了用户取消更新查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含数百万行的表.

I have a table that has millions of rows.

我不小心在没有 where 子句的表上写了一个更新查询,然后点击了执行.

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

它开始执行.两秒钟后,我意识到查询是错误的,我单击了 Sql Server Management Studio 中的Stop"按钮.查询执行被停止,这一切都发生在 7 秒内.

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?

推荐答案

单个更新语句不会更新某些行.要么全行,要么全行

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

这是原子性/en.wikipedia.org/wiki/ACID" rel="noreferrer">ACID 属性,SQL 服务器非常尊重这些属性.

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

这篇关于用户取消更新查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆