SQL server 2008 -how to Audit old/new columns value through after Insert/update /delete trigger
Posted on 2013-11-15
Would some one please help by give me some codes example for Trigger syntax for SQL server 2008 . The below are what I am looking for to do.
( I am not familiar with SQL server 2008 trigger, I only know some basic of Oracle trigger).
For Audit report purpose, I would like to create the after insert, update, delete trigger that for every change made per record in table A ( For each insert row, update row, delete row ), the trigger would able to record the change per row by insert into an audit table B. Which Each row in table B store the column value before it is change and after it is changed (2 column in table B one with old value and one with new value for a column that change per record).
The reason is user want to tract every change made to Table A and able to use table B as audit report display through the app. ( app build to display results set based on user input for tract change )
Thanks very much,