Solved

Undo a query in Sql server 2005 - rollback

Posted on 2008-10-07
3
2,405 Views
Last Modified: 2012-05-05
Hello,
i executed the following query :
UPDATE dbo.SrDDW
SET
BPmaterial = 'NA'
FROM         dbo.SrDDW
WHERE (ProductType <> N'body')

and it was a big mistakes in the filter of the where clause!!!!

is there any method i can undo the change in the SrDDW table
0
Comment
Question by:Nyana22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22663091
if you had a BEGIN TRANSACTION before the update:
ROLLBACK

otherwise, you will have to RESTORE the database with a FULL backup of before that, and in case your db is in full recovery mode, you have to do a t-log backup (before the restore, of course), and you can restore to the point in time before that errror.
0
 

Author Comment

by:Nyana22
ID: 22663115
Hi angelll,
i didnt have a begin transaction.

now the data is modified in the table
if i make a backup, and after i will make a restore, the data will be the one just befire this query???
please

thanks
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22663186
as I said, you will need a full backup BEFORE the problem...

you might want to check out to stop any activity on the db, and try out third-party tools to read the t-log, to get the updates to undo the work: lumigent logexplorer is one of those tools.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question