Brandon
Brandon

Reputation: 14196

Find previous value of a DB record from transaction logs?

Trying to track down a bug in an application, but need to confirm whether a column value was changed on a particular record in SQL 2005.

How can I query the transaction logs for the record's previous column values?

Upvotes: 1

Views: 1021

Answers (2)

Martin Smith
Martin Smith

Reputation: 453278

Agreed it won't be easy. You can also investigate fn_dblogas in this post Decoding a Simple Update Statement Within the Transaction Log

Upvotes: 2

Ryan Brunner
Ryan Brunner

Reputation: 14851

Transaction logs aren't typically supposed to be directly queryable, but for exceptional circumstances, you can use the DBCC LOG command to get information from the transaction log. The output isn't exactly straightforward, and it would be a difficult task to determine whether a given column value was changed.

If you know the date of the change, it would probably be simpler to restore a copy of the database before and after the change to verify that the change was made.

Upvotes: 0

Related Questions