-
May 16th, 2022, 12:20 PM
#1
Thread Starter
Frenzied Member
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...
-
May 16th, 2022, 12:21 PM
#2
Re: Find changes on sql database table
Do you have any logging/transaction logs still available?
Please remember next time...elections matter!
-
May 16th, 2022, 12:24 PM
#3
Thread Starter
Frenzied Member
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...
-
May 16th, 2022, 12:26 PM
#4
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!
-
May 16th, 2022, 12:29 PM
#5
Thread Starter
Frenzied Member
Re: Find changes on sql database table
Okay thank you Tyson. I'll run that one down
-
May 16th, 2022, 12:47 PM
#6
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.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
May 16th, 2022, 12:51 PM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|