Please start any new threads on our new site at 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)
 Restore old values after update for only 8 rows

Author  Topic 

Starting Member

6 Posts

Posted - 2013-01-19 : 08:38:38

I'm having a table Employee. by mistake because of update script i have
updated column Emp_account_no of 8 employee. I want to restore previous account no of those 8 employee.
Rollback wont work.So i want to write simple procedure which will restore my previous acc no.
Table name: Employee
DB name: Company
Modified column name Emp_acc_no
Primary key: Emp_id
I'm using sql server 2000

Please can any one help me i'm in big trouble.

Thanks and regards


James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-19 : 12:03:06
If you know the Emp_Id's of the employees whose Emp_Acc_no need to be reverted, then you can do the following:
UPDATE Employee SET Emp_acc_no = 'CorrectAcctountNumber' WHERE Emp_id = 12345;

Since there are only eight rows, I would do them one by one carefully. Be very very careful to include the where clause, or you will destroy the account numbers of all employees!

Test it in a dev server to make sure you are doing the right thing.
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-19 : 13:29:30
is there a logic to identify those 8 records? or do you know their ids?

SQL Server MVP

Go to Top of Page

- Advertisement -