Search code examples
sql-server-2008transaction-log

view the changed values after an update statement


just wondering if it is possible to view the changes of an update command on a table after it has happened?

would the transaction log store this kind of information i.e this is the previous/current value this is the new/changed value

not sure if this is possible. the server is ms sql 2008


Solution

  • The transaction log does contain the information, although decoding it is not trivial - I wrote a blog post with an example of decoding a simple update statement in the transaction log - http://sqlfascination.com/2010/02/21/decoding-a-simple-update-statement-within-the-transaction-log/

    However, depending on the update being performed the entries in the log get a lot more complex and there is no documentation available on how to decode them. Reverse engineering them is quite difficult.

    I would never recommend that this technique of inspecting the log is used to retrieve data, it is only worth looking into from an internals learning perspective / forensic perspective.