Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2003
    Posts
    15

    Question Unanswered: Rollback changes done to a query in SQLserver

    Hi,
    I have updated awrong table in SQLSERVER....
    But I want to rollback the changes as I have updated a wrong table
    Will anyone let me know

    very very urgent.


    Ravi

  2. #2
    Join Date
    Jul 2003
    Location
    England
    Posts
    152
    This is how I would do it -

    restore your db to somewhere else - do a point in time recovery to just before you made the offending changes.

    Identify the rows you have altered.

    Then either manually re-update the rows with the old values, or copy out the rows and replace the updtaed rows with them.

    One question though - if the system has been used since, how do you know the rows have not been updated since?
    Regards
    Dbabren

  3. #3
    Join Date
    Jul 2003
    Location
    England
    Posts
    152
    Meant to say at start of last post - I have assumed the updates have been commited? - silly question perhaps, but always worth asking ..
    Regards
    Dbabren

  4. #4
    Join Date
    Sep 2003
    Posts
    15

    Question Rollback changes done to a Table in SQLserver6.5

    Hi
    1.I updated Table XYZ in SQlServer 6.5
    2.80 rows have been updated
    3.I want to rollback changes to that table so that it will restore original data.
    Please respond immediately

    Cheers,
    Ravi

  5. #5
    Join Date
    Jul 2003
    Location
    England
    Posts
    152
    Have the 80 updates been committed?
    If they have then see my first post.
    If not then 'rollback transaction' will undo the updates.

    If your updates have committed, then SQL server cannot roll those changes back - it becomes a recovery issue.
    Regards
    Dbabren

  6. #6
    Join Date
    Sep 2003
    Posts
    15

    Rollback changes done to a Table in SQLserver6.5

    Originally posted by dbabren
    Have the 80 updates been committed?
    If they have then see my first post.
    If not then 'rollback transaction' will undo the updates.

    If your updates have committed, then SQL server cannot roll those changes back - it becomes a recovery issue.
    Hi
    I think they have been updated as I have done a select query on that Table, it is showing the updated Values

    I dont know ho SQL server performs commits whether autocommit or...

    Please let me process to rollback if possible or the only way is to Recover....



    I am new to SQL Server and Database Side.

  7. #7
    Join Date
    Jul 2003
    Location
    England
    Posts
    152
    If you can see the updated values from a second sql session - then the updates are committed

    (SQL server will normally autocommit by default unless you wrap your statements with 'begin transaction' and 'commit transaction').

    You will have to point in time recover the database on another server. It is reasonably easy to do via Enterprise manager.

    You will need to -
    - get your last backup
    - backup the transaction log file and use that in your recovery as well.
    Regards
    Dbabren

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •