What Audit trigger
here will do:
Audit trigger – to audit DML operations on all tables in a
database.
Audit trigger is created by using stored procedure “GenerateAudittrail” & function “Upd_trg_col_populate”.
What
stored procedure “GenerateAudittrail” here will do :
Create exact copy of all tables in a database with extra
audit columns and name suffixed as ‘_audit’.
Create Insert/Update/Delete trigger for all original tables .
Triggers are created in such a way that whenever DML operations
take place on all original tables ,audit
tables will be populated accordingly.
What function “Upd_trg_col_populate”
here will do:
In case of update
operation,only updated column value of that table along with audit columns will
get populated in audit tables
“Upd_trg_col_populate” function is called inside “GenerateAudittrail” procedure.
Step 1: --create test data