Audit Table update via trigger
Posted on 2012-03-30
I'm trying to create an update trigger on a particular table that will fire BEFORE the update takes place. I'd like the trigger to select the values of the record that are about to be updated and insert them into another table first and THEN fire the update statement.
So, prior to updating table1-recordx, I want to insert the values of recordx into table2.
We will be using this technique as a way of auditing changes to a particular table with the ability to easily roll those changes back via a web-app front end screen.
Anyone know of a simple way to do this in SQL Server? Version is 2008 R2 if that matters.