Tracking changes in a SQL server 2005 database

前端 未结 8 1531
既然无缘
既然无缘 2020-12-29 00:05

I have been tasked with developing a solution that tracks changes to a database.

For updates I need to capture:

  • date of update
  • old value
8条回答
  •  执笔经年
    2020-12-29 00:21

    I've had a setup in SQL Server where we would use views to access our data, which would handle inserts, updates and deletes with INSTEAD OF triggers.

    For example: an INSTEAD OF DELETE trigger on the view would mark the records in the underlying table as deleted, and the view was filtered to not show deleted records.

    In all triggers, we updated a modification date and user name. The trouble is that that logs the database user name, which is not the same as the ultimate application user name.

    The view needs to be schema bound for this to work.

提交回复
热议问题