Generating Audit Triggers in SQL

This is a placeholder post, but I wanted to get the code out there for someone.
Here's the actual DDL trigger. It really just intercepts creates and alters to tables and calls a stored proc to generate the audit trigger. The stored proc does the work. We support skipping audit on certain tables by setting an extended property on that table. We're considering the same idea on columns to skip audits on specific columns. In our case we use the RowGuid on each row as the identifier in the audit and we care about an application-specific ChangeUserID, not the user connected to SQL. And if you want to run it for all tables there's this sproc:

No comments:

Post a Comment