How can I rollback an UPDATE query in SQL server 2005?

后端 未结 10 2412
北海茫月
北海茫月 2020-12-14 09:15

How can I rollback an UPDATE query in SQL server 2005?

I need to do this in SQL, not through code.

10条回答
  •  半阙折子戏
    2020-12-14 09:40

    begin transaction
    
    // execute SQL code here
    
    rollback transaction
    

    If you've already executed the query and want to roll it back, unfortunately your only real option is to restore a database backup. If you're using Full backups, then you should be able to restore the database to a specific point in time.

提交回复
热议问题