Suggestions for implementing audit tables in SQL Server?

后端 未结 6 2165
春和景丽
春和景丽 2020-12-01 09:33

One simple method I\'ve used in the past is basically just creating a second table whose structure mirrors the one I want to audit, and then create an update/delete trigger

6条回答
  •  天涯浪人
    2020-12-01 09:51

    We are using two table design for this.

    One table is holding data about transaction (database, table name, schema, column, application that triggered transaction, host name for login that started transaction, date, number of affected rows and couple more).

    Second table is only used to store data changes so that we can undo changes if needed and report on old/new values.

    Another option is to use a third party tool for this such as ApexSQL Audit or Change Data Capture feature in SQL Server.

提交回复
热议问题