Need INSERT, UPDATE and DELETE triggers for two tables.
A record should be written to the table named tblAuditLog for each column that is modified in the two tables (named:tblCommissionExpected and tblCommissionSplit)
Identity columns are excluded fro being written to the audit log. Also, CreatedOn, ChangedBy and ChangedDate columns are not written to the audit log.
Only columns that change need to be written. When multiple rows are changed, each changed value in each row must be written to the audit log.
When a column is "char" type the old and values should be written to "OldCharValue" and "NewCharValue".
When a column is "smalldatetime" the old and new values are to be written to "OldDatetimeValue" and "NewDatetimeValue".
When a column is "varchar" type the old and values should be written to "OldCharValue" and "NewCharValue".
.... and so on .................
Inserts will have no OldValue (NULL)
Deletes will have no NewValue (NULL)
DDL for the tables is supplied in attached file.
1) Complete and fully-functional working triggers in SQL Script form.
Microsoft SQL Server 2000