How to rollback an implicit SSMS transaction (statement with go at the end)?

sql, sql-server, sql-server-2008, ssms, transactions

Solution

see the link below, I think it will help you

How to recover the old data from table

thanks Arun

Problem

Question: Normally, you can undo a sql command with rollback. ``` BEGIN TRY BEGIN TRANSACTION /* run all your SQL statements */ COMMIT TRANSACTION END TRY BEGIN CATCH ROLLBACK TRANSACTION END CATCH ``` My question now: If 'one' did this ``` UPDATE TABLE_X SET FIELD_X = 'bla' GO ``` in SSMS (notice the go at the end) and forgot to specify the WHERE clause, is it possible (and how) to rollback the implicit transaction that SSMS executed this command in (statements with go at the end are implicitly executed in a transaction) ? Note: I didn't do that, but a colleague of mine did a few days ago (without go). I undid the damage he did (fortunately I made a backup 0.5 hours before he did that), but for the future, it would be good to know this, because this happened to me once, too.

Original source