Showing posts with label forgetted. Show all posts
Showing posts with label forgetted. Show all posts

Wednesday, March 21, 2012

Restoring rows accidentaly modified

Hello!
How can I Restore rows which are accidentaly modified.
I forgetted to put where condition in "Update" Query.
Now I want my data back. I have not taken back up manually yet.
I am using SQL Server 2000.
Please help.
Thank you,There is a way, but none via sql. As far as I know, you'rebasically SoL. Transactions can be rolled back, but you can't doit after it's already been commited. There's applications outthere that supposedly can do it, but I can't for the life of meremember the names of them.
Sorry man.
|||

Tsk tsk tsk ... let this be a lesson.
1) ***NEVER*** develop a DML script (UPD,INS,DEL) in production -- that's what a dev database is for
2) Backup your database every night or if possible, more often

|||

Alex Papadimoulis wrote:

Tsk tsk tsk ... let this be a lesson.


1) ***NEVER*** develop a DML script (UPD,INS,DEL) in production -- that's what a dev database is for


Well, I would assert that there are times where a DML script isneeded in production, and you don't have the luxury of using a devdatabase first. My suggestion is to ALWAYS wrap it in atransaction, with a ROLLBACK at the end, until you obtain the desiredresults.
BEGIN TRANSACTION
UPDATE
someTable
SET
someColumn = 'someValue'
WHERE
someCondition = 'True'
ROLLBACK -- change to COMMIT once you know you are updating the correct records
I ALWAYS ALWAYS ALWAYS do this, lesson learned the hard way.