Writing a generic audit trail trigger in SQL Server

Writing a generic audit trail trigger in SQL Server to keep track of inserts, deletes, and updates within a table is explained in this expert response.

How do you write an audit trail trigger in SQL Server 2000? I want to keep track of inserts, deletes and updates of all of the tables in a particular database.
Writing a generic audit trail trigger in SQL Server can be a bit tricky, as it requires manipulation of a bitmask exposed by the COLUMNS_UPDATED function. You'll also need to figure out how to store disparate data types in some generic fashion, which might be difficult if your database uses TEXT, NTEXT, or IMAGE columns.

Luckily, SQL Server MVP Nigel Rivett has already done most of the work. You can find his audit trigger at Nigel's Web site.

Dig Deeper on Microsoft SQL Server Performance Monitoring and Tuning

SearchBusinessAnalytics
SearchDataCenter
SearchDataManagement
SearchAWS
SearchOracle
SearchContentManagement
SearchWindowsServer
Close