上次修改日期对象 [英] Date object last modified

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

问题描述

如何找出 MS SQL Server 2000 对象上次修改的日期?

How can I find out the date a MS SQL Server 2000 object was last modified?

我需要获取自 8 月 15 日以来修改的所有视图、过程、函数等的列表.在 sysObjects 中,我可以看到创建的日期对象,但我需要知道它们上次更改的时间.

I need to get a list of all the views, procs, functions etc that were modified since Aug 15th. In sysObjects I can see the date objects were created but I need to know when they were last altered.

注意:这是一个 SQL 2000 数据库.

NB: this is an SQL 2000 database.

推荐答案

请注意,SQL Server 实际上记录上次修改日期.它不存在于任何系统表中.

Note that SQL Server actually does not record the last modification date. It does not exist in any system tables.

架构更改历史报告实际上是根据默认跟踪构建的.由于许多管理员(和网络主机)将其关闭,因此它可能对您不起作用.Buck Woody 很好地解释了这份报告的工作原理 此处.数据也是临时的.

The Schema Changes History report is actually constructed from the Default Trace. Since many admins (and web hosts) turn that off, it may not work for you. Buck Woody had a good explanation of how this report works here. The data is also temporary.

因此,您永远不应依赖架构更改历史报告.替代方案:

For this reason, you should never RELY on the Schema Changes History report. Alternatives:

  • 使用 DDL 触发器 将所有架构修改记录到您的选择.
  • 执行一个协议,视图和过程永远不会改变,它们只会被删除和重新创建.这意味着创建日期也将是最后更新日期(这显然不适用于表).
  • 在源代码管理中警惕地对 SQL 对象和架构进行版本控制.
  • Use DDL Triggers to log all schema modification to a table of your choosing.
  • Enforce a protocol where views and procs are never altered, they are only dropped and recreated. This means the created date will also be the last updated date (this does not work with tables obviously).
  • Vigilantly version your SQL objects and schema in source control.

--

看到这是 SQL 2000.这排除了默认跟踪和 DDL 触发器.你只剩下我上面列出的一个更乏味的选项.

saw that this is SQL 2000. That rules out Default Trace and DDL Triggers. You're left with one of the more tedious options I listed above.

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

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