How can a Table's Last Modified date be return

2019-08-23 05:20发布

How can a Table's Last Modified date be returned in SQL Server 2005?

I did see one on the Table Properties page. There is a Created Date but no Modified date.

If it is not available, what would be some other ways to add this functionality?

Here are a few that come to mind:

  1. Add another column, to the table, that a trigger would update whenever the record was added or changed. The one con, to this approach, is Deletes would not be tracked.
  2. Add another table (TableModifiedDate) that would contain a Table Name and Modified Date. Then add a trigger to the tables that you want to track which will update TableModifiedDate.

2条回答
时光不老,我们不散
2楼-- · 2019-08-23 06:14

This Blog entry contains information on how to do it on SQL Server 2008 and 2005.

  • On 2008: using the new Server Auditing feature
  • On 2005: using Dynamic Management Views (DMV)

SQL Server 2000 has no built-in possibility to do it, so you'll need a workaround, like you already mentioned.

查看更多
Lonely孤独者°
3楼-- · 2019-08-23 06:19

Paul Nielson's AutoAudit is a quick and effective way of retro-fitting this to a database. He has a demo screencast here.

查看更多
登录 后发表回答