Is there a way to find out what data was changed by a stored proc after it was executed?

  • My brain is dead today, but isn't there an automatic log of some sort to check and see what exactly was changed by a given SQL command? A stored proc was ran and I need to figure out what exactly it changed in the underlying table. Anyone?

  • Siberian Khatru (7/22/2015)


    My brain is dead today, but isn't there an automatic log of some sort to check and see what exactly was changed by a given SQL command? A stored proc was ran and I need to figure out what exactly it changed in the underlying table. Anyone?

    Unless you have some kind of auditing in place there is nothing you can do here. It would be ridiculous if sql server by default tracked every single change to data along with when it happened and what caused it to change. The amount of data required for that would be staggering to say the least.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • If absolutely necessary, I'm not sure if a point in time restore could help to get the data before the execution of the stored procedure.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • I ended up using the SQL Data Compare utility from RedGate against a backup restored under a different name from just prior to the SP running. Easy peasy.

    Should have thought of that in the first place, but I did say my brain was dead today 🙂

    Thanks folks.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply