Create Data Audit in SQL Server
问题 I've recently been given the task of creating an Audit on a database table so that any changes made to any columns can be tracked. Lets say I have the following table: [TableA] ------ ID ColumnA ColumnB ColumnC For Auditing I've created a table such as: [TableA.Audit] ------ ID TableAID UserID Date (default value = getdate()) ColumnA ColumnB ColumnC I've then wrote a script like: DECLARE @currentColumnA int ,@currentColumnB int ,@currentColumnC int SELECT TOP 1 @currentColumnA=ColumnA ,