MAK
MAK

Reputation: 7260

Rollback after update

I have a table with some records:

Table:

create table test
(
   column1 varchar(10),
   column2 varchar(10),
   column3 varchar(10),
);

Insert:

insert into test values('A','B','C');
insert into test values('E','F','G');
insert into test values('J','H','I');

Update:

By mistake update:

Update test
set column1 = 'XYZ';

The above statement updates all rows.

The actual update:

Update test
set column1 = 'XYZ'
where column3 = 'I';

How can I get previous records which are available before update?

Upvotes: 1

Views: 91

Answers (1)

Andrey Morozov
Andrey Morozov

Reputation: 7979

Restore to a Point in Time (of course if your database use FULL RECOVERY MODEL and you have a log backups) or if you are using SIMPLE RECOVERY MODEL you can restore your database somewhere "near" the one and join affected table on the current and restored databases to find and restore only affected data (because some data in the current database may be already changed since the time of UPDATE)

Upvotes: 1

Related Questions