在数据库中维护历史记录
发布时间:2020-12-12 06:22:00 所属栏目:MsSql教程 来源:网络整理
导读:我正在设计这个数据库,必须保留员工薪资和组织内部动向的历史记录.基本上,我的设计有3个表(我的意思是,有更多的表,但对于这个问题我会提到3,所以请耐心等待).员工表(包含最新的薪水,职位数据等),SalaryHistory表(薪水,日期,原因等)和MovementHistory(Title,De
我正在设计这个数据库,必须保留员工薪资和组织内部动向的历史记录.基本上,我的设计有3个表(我的意思是,有更多的表,但对于这个问题我会提到3,所以请耐心等待).员工表(包含最新的薪水,职位数据等),SalaryHistory表(薪水,日期,原因等)和MovementHistory(Title,Dept.,comments).我将使用
Linq到Sql,所以我想的是每次更新员工数据时,旧值将被复制到各自的历史表中.这是一个好方法吗?我应该使用Linq to SQL或触发器吗?感谢您的任何帮助,建议或想法.
解决方法看看 http://www.simple-talk.com/sql/database-administration/database-design-a-point-in-time-architecture.基本上,本文建议您在跟踪历史记录的表格中包含以下列: * DateCreated – the actual date on which the given row was inserted. * DateEffective – the date on which the given row became effective. * DateEnd – the date on which the given row ceased to be effective. * DateReplaced – the date on which the given row was replaced by another row. * OperatorCode – the unique identifier of the person (or system) that created the row. DateEffective和DateEnd一起告诉您行有效的时间(或员工在某个部门的时间,或者他获得特定薪水的时间). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |