Results 1 to 2 of 2

Thread: Rollback

  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Rollback

    I imported some duplicate records using a DTS and I need to "undo" that import. I think a rollback would be appropriate but I've never done one before. can anyone offer some advise and/or the general steps needed to do a rollback?
    Thanks.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can only do a rollback if you have started a transaction with BEGIN TRAN and have not committed with COMMIT.

    Since you already imported the records the transaction is already committed so you can't use rollback. You will have to find a way to find the duplicate records and delete them one by one. If you have a column(s) in the table that uniquely identifies a row you can use

    select pkcolumn, count(*)
    from yourtable
    group by pkcolumn
    having count(*) > 1

    to get all duplicate rows and delete one of the rows.

Posting Permissions

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