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

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Restore old values after update for only 8 rows
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

6 Posts

Posted - 01/19/2013 :  08:38:38  Show Profile  Reply with Quote

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
Flowing Fount of Yak Knowledge

3866 Posts

Posted - 01/19/2013 :  12:03:06  Show Profile  Reply with Quote
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 - 01/19/2013 :  13:29:30  Show Profile  Reply with Quote
is there a logic to identify those 8 records? or do you know their ids?

SQL Server MVP

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.04 seconds. Powered By: Snitz Forums 2000