Roolback in SQL Server


If accidentally you did some CRUD operation in the table then, here I am telling how to get back to the previous stage.

BEGIN TRANSACTION;
update tblName set FirstName='test' where id=1;
rollback ;


This will get you back to your previous stage(UNDO).
And if you want to get-back any particular column data then go for it.

BEGIN TRANSACTION transiction_name;
update tbl_name set FirstName='test' where id=1;
rollback transaction transiction_name;

Comments

Technology