Long story short is I tried to quickly update a single row in SQL Server using the Management studio and just typed UPDATE table SET column='value' and forgot the WHERE other_column='other_value' portion. Went for lunch, came back and theres 15 unread emails waiting for me. Happened about an hour ago, waiting for the database guy to come back to see when the last backup was. There’s no magic UNDO feature though is there?
Long story short is I tried to quickly update a single row in SQL
Share
Yes, there is – it’s the transaction log. To recover from something like this, as long as you have your database in FULL recovery model, you’d just do another transaction log backup, and then do a restore with the STOPAT option set to tell the restore to stop restoring at the point in time right before you started your transaction. This will revert the database back to the point of your mistake.
See here for more info on using the STOPAT option – http://msdn.microsoft.com/en-us/library/ms186858(SQL.90).aspx.
Your script would look something like this…