Help me buddy's... in sql server 2005 (topic:columns update)

  • Hi everyone,

    I would appreciate if anyone help me in this topic.In brief i will describe about my work done;

    1) I have CREATED TABLE call it as CUSTOMER with columns(id,name,age,address,salary).

    2) I have inserted 3Rows in this table as below:

    :discuss:

    ID NAME AGE ADDRESS SALARY

    1 AA 12 CHENNAI 2000.00

    2 BB 18 BOMBAY 18,000.00

    3 CC 22 DELHI 25,000.00

    3) i have now UPDATED THIS TABLE with the below query

    UPDATE CUSTOMER SET SALARY = 5000.00

    4) The COLUMN SALARY got updated by default value 5000.00. Now table looks like below:

    ID NAME AGE ADDRESS SALARY

    1 AA 12 CHENNAI 5000.00

    2 BB 18 BOMBAY 5000.00

    3 CC 22 DELHI 5000.00

    5) Now my question is how can i get the old values in the table , as i inserted.

    we can use WHERE CONDITION WHILE UPDATING A COLUMN BUT UNFORTUNATELY I UPDATED NOW I WANT TO BRING IT BACK AS I INSERTED PLEASE ANYONE HELP ME.:unsure:

  • DivyaMohankumar (7/11/2013)


    5) Now my question is how can i get the old values in the table , as i inserted.

    Get a backup that was taken before the update was done, restore it as a new database, copy the overwritten data out.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi Gail

    Thanks for your reply...

    And i am sorry for , i did not take a back up for it . . . So i am unable to do that

  • If you don't have a backup then you cannot get the old values back. Unless you did the update in an explicit transaction and that transaction has not yet been committed

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • thanks for your reply.. hehe:

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply