SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Undo Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sa
Yak Posting Veteran

Philippines
77 Posts

Posted - 10/16/2006 :  21:45:53  Show Profile  Reply with Quote
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)

Singapore
17681 Posts

Posted - 10/16/2006 :  21:51:50  Show Profile  Reply with Quote

if  you had a BEGIN TRANS then 

    you can ROLLBACK

else

    restore from backup

end if



KH

Go to Top of Page

sa
Yak Posting Veteran

Philippines
77 Posts

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

Kristen
Test

United Kingdom
22431 Posts

Posted - 10/17/2006 :  13:46:51  Show Profile  Reply with Quote
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

India
1 Posts

Posted - 05/31/2010 :  23:45:04  Show Profile  Reply with Quote
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

India
22772 Posts

Posted - 06/01/2010 :  02:07:31  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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

United Kingdom
22431 Posts

Posted - 06/01/2010 :  02:47:56  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000