如何回滚我的更新查询 [英] How to Rollback my update query

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

问题描述

UPDATE <table name>
SET machine_incharge='Expense Approver1', active_machine='yes'



不幸的是在没有条件的情况下执行了将近800行,请帮助我回滚查询.

在此先感谢

问候
vamsi krishna j



unfortunately executed with out where condition it is effected nearly 800 rows please help me to roll back the query.

Thanks in Advance

Regards
vamsi krishna j

推荐答案

Rollbach不适用于DML语句.
它必须具有开始交易"或开始交易"
试试这个:
Rollbach does not work with DML statement.
It must have a "begin tran" or "begin transaction"
Try this:
begin tran test
Update salesproposal set statuscode = 4 where so_id = 47888
UPDATE <table name="">
SET machine_incharge='Expense Approver1', active_machine='yes'
end tran;

</table>


现在您可以
要么


now you can
either

rollback tran test




or

Commit tran test


如果未在事务中完成,则无法回滚.

为了对任何查询使用回滚,必须从 BeginTransaction [ ^ ]方法.

上面的链接提供了给定事务的提交和回滚示例.
If it was not done in a Transaction, then you cannot roll it back.

In order to use a rollback on any query, you have to start with BeginTransaction[^] method.

The link above has an example of both a Commit and Rollback for a given transaction.


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

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