How to undo a SQL Server UPDATE query?

前端 未结 5 1764
旧巷少年郎
旧巷少年郎 2021-02-03 21:22

In SQL Server Management Studio, I did the query below.
Unfortunately, I forgot to uncomment the WHERE clause.
1647 rows were updated instead of 4.

5条回答
  •  旧巷少年郎
    2021-02-03 21:56

    If you can catch this in time and you don't have the ability to ROLLBACK or use the transaction log, you can take a backup immediately and use a tool like Redgate's SQL Data Compare to generate a script to "restore" the affected data. This worked like a charm for me. :)

提交回复
热议问题