在ms sql 2008中检查行上的修改日期 [英] Checking modification date on a row, in ms sql 2008

查看:70
本文介绍了在ms sql 2008中检查行上的修改日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!



我的问题是,我需要检查,当上次修改一行时,但我没有任何列,其中包含数据。我的问题是:有没有办法,我可以检查这些数据?



THX,任何答案!

Hi!

My problem is, that I need to check, when a row was last modified, but I don't have any column, that contains the data. My question is: Is there any way, that I can check this Data?

THX, for any answers!

推荐答案

否您无法确定行级别的上次更新日期。 SQL服务器保留这样的记录是没有意义的。考虑所需的空间量和其他开销。虽然最后修改的细节保存在对象级别。



您也可以查看此帖子 - 上次修改的SqlServer行日期 [ ^ ]
No you cannot determine last updated date on a row level. It doesn't make sense for SQL server to keep such record. Think the amount of space and other overheads that will be required. Though last modified details are saved at object level.

You may also check this post - SqlServer row date last modified[^]


当信息不可用时,您无法获得信息。

由于你无法改变原始表,我能想到的一种方法是创建一个只有2个字段的新表 - 一个id字段和一个datetime字段。 id字段将链接到原始表的主键。每当在原始表中插入,更新或删除行时,它还应该使用当前日期时间值插入/更新新表中的相应id行。您可以使用触发器自动执行此过程。通过这种方式,您可以跟踪对原始表中任何行所做的任何更改。
You cannot have the information when the information is not available.
Since you cannot alter the original table, one way I can think of is to create a new table that has only 2 fields - an id field and a datetime field. The id field will link to the primary key of the original table. Whenever a row is inserted, updated, or deleted in the orginal table, it should also insert/update the corresponding id row in the new table with the current datetime value. You may use trigger to automate this process. In this way, you can keep track of any changes made to any row in the original table.


这篇关于在ms sql 2008中检查行上的修改日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆