Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Undo Query

Author  Topic 

sa
Yak Posting Veteran

77 Posts

Posted - 2006-10-16 : 21:45:53
hi, got a problem here. is there any way i can undo the changes made by query. i am using query analyzer and ive executed a wrong query.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-16 : 21:51:50
[code]
if you had a BEGIN TRANS then

you can ROLLBACK

else

restore from backup

end if
[/code]


KH

Go to Top of Page

sa
Yak Posting Veteran

77 Posts

Posted - 2006-10-16 : 21:53:29
well i better start restoration the backup. thanks so much.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-10-17 : 13:46:51
If you have transaction log backups you can restore to a point-in-time just-before the accident.

You could also restore to a new, temporary, database and then "sort out" the data by copying data from the Temp database selectively.

Kristen
Go to Top of Page

sayrath
Starting Member

1 Post

Posted - 2010-05-31 : 23:45:04
hi
i got a same kinda prob here. but i didnot took any backup prior to the execution of command. can we restore that?
quote:




quote:
Originally posted by sa

hi, got a problem here. is there any way i can undo the changes made by query. i am using query analyzer and ive executed a wrong query.



Thanks,
SARATH
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-01 : 02:07:31
quote:
Originally posted by sayrath

hi
i got a same kinda prob here. but i didnot took any backup prior to the execution of command. can we restore that?
quote:




quote:
Originally posted by sa

hi, got a problem here. is there any way i can undo the changes made by query. i am using query analyzer and ive executed a wrong query.



Thanks,
SARATH


What type of command here?

Suppose you want to update column value by adding 10. But you mistakenly multiplied it. In this case you can undo it by dividing by 10

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-06-01 : 02:47:56
You do not need to take a backup just before an "accident".

Do you have recent FULL back and is your database running in FULL Recovery model?

If NO then there is no easily feasible way to reverse it (unless you can reverse the calculation as Madhi explained)

If YES take a TAIL TLog backup and restore to "point-in-time" just before the accident.

You can restore to new, temporary, database and then "copy" data from that to your Live database to sort the problem out (without losing other data you have changed since)
Go to Top of Page
   

- Advertisement -