如何回滚我的更新查询

编程入门 行业动态 更新时间:2024-10-28 05:18:24
本文介绍了如何回滚我的更新查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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.

更多推荐

如何回滚我的更新查询

本文发布于:2023-10-19 19:32:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1508546.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!