开发者

Which approach is better - change tracking attribute in each table vs one tracker table

开发者 https://www.devze.com 2023-02-25 08:16 出处:网络
I am trying to decide between 2 approaches to tracking whether a record has changed or not and when and by whom. I am not interested in obtaining the actual data that has changed but only the fact tha

I am trying to decide between 2 approaches to tracking whether a record has changed or not and when and by whom. I am not interested in obtaining the actual data that has changed but only the fact that the data has changed. I am using SQL Server 2008.

First approach is to have the following 6 columns in each tables: Created On, Created By, Last Updated On, Last Updated by, Deleted On and Deleted By.

Second approach is to have a single table, let us call it Change Tracker, which has those 6 columns and other tables would have a FK to the Change Tracker 开发者_如何学编程table.

which is a better practice and why?

Also, do I need to have these columns if I enable change tracking in SQL Server?


i see no advantages of second approach, always using first one. btw, deleted_by and deleted_on are redundant fields. created_xx and updated_xx fields are enough

0

精彩评论

暂无评论...
验证码 换一张
取 消