Results 1 to 7 of 7

Thread: Find changes on sql database table

  1. #1

    Thread Starter
    Frenzied Member schoemr's Avatar
    Join Date
    Apr 2016
    Location
    South Africa
    Posts
    1,220

    Find changes on sql database table

    Hi, I made a mess.

    in a specific table I ran a query to update a specific column value for a specific user

    Code:
    Update MyTable SET MyColumn = 'SomeValue' WHERE UserID ='123'
    A large number of records was updated. It was only then that I realized that I had to specify another condition also in the WHERE clause. With the additional condition or parameter much less rows would have been impacted.

    I have the date it was done, I have an approximate time, I have the UserID...

    Is is possible to see in MyColumn what was changed to what?


    Unfortunately for me the last backup was too long ago otherwise I could have restored..

    Of course there be lessons to learn here but right now I need to fix the mess I made...
    Don't miss the whole point of the dance...

    https://www.youtube.com/watch?v=qHnIJeE3LAI

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,670

    Re: Find changes on sql database table

    Do you have any logging/transaction logs still available?
    Please remember next time...elections matter!

  3. #3

    Thread Starter
    Frenzied Member schoemr's Avatar
    Join Date
    Apr 2016
    Location
    South Africa
    Posts
    1,220

    Re: Find changes on sql database table

    Hi Tyson, I think there should be. This happened only a few days ago...

    Is that something that should have been enabled? I can't check now at the moment. I can only check in the morning...
    Don't miss the whole point of the dance...

    https://www.youtube.com/watch?v=qHnIJeE3LAI

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,670

    Re: Find changes on sql database table

    It has been a while but Google:

    ssms restore from transaction log

    I just did and you may be able to point and click your way out.
    Please remember next time...elections matter!

  5. #5

    Thread Starter
    Frenzied Member schoemr's Avatar
    Join Date
    Apr 2016
    Location
    South Africa
    Posts
    1,220

    Re: Find changes on sql database table

    Okay thank you Tyson. I'll run that one down
    Don't miss the whole point of the dance...

    https://www.youtube.com/watch?v=qHnIJeE3LAI

  6. #6
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,171

    Re: Find changes on sql database table

    First take a backup. You don't want to mess things up more.
    Also check you recovery model. If it simple recovery model, I'm afraid there is not much you can do because as you have said, the last backup was a long time ago.
    Also an advice.I have to deal with millions of rows so I always use transaction when I run a query.
    If you are stuck you can also ask an admin to move this to the database forum (should be there in the first place), there are a lot of experts more suitable than me there, possibly a db administrator can help you more.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    37,412

    Re: Find changes on sql database table

    Ah, let's just move it anyways. Might get some other answers, though these seem pretty good.
    My usual boring signature: Nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width