Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date object last modified

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

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.

NB: this is an SQL 2000 database.

like image 770
Mark Plumpton Avatar asked Sep 16 '08 23:09

Mark Plumpton


People also ask

What does date Last Modified mean?

The "Last Time Modified" date refers to the last time a document or media file was modified. This information is gathered from metadata within the document or from the website's servers.

How do I find the last modified date?

Open the webpage in a browser that you want to find the last updated date. Go to address bar and type the command “javascript:alert(document. lastModified)” at the end of the URL. Press enter to see a popup showing the last updated or modified date of that page.

How do I get the last modified date in HTML?

The DOM lastModified property in HTML is used to return the date and time of the current document that was last modified. This property is read-only. This property returns a string which contains the date and time when the document was last modified.

What does last modified mean on job application?

Last Modified = the last time a candidate modified their resume or employment information, such as changing job title, education, or location.


2 Answers

I know this is a bit old, but it is possible to view the last altered date of stored procs and functions with this query:

USE [Your_DB]    
SELECT * FROM INFORMATION_SCHEMA.ROUTINES

Just thought it would be nice to mention this since I searched for this very solution and this thread was misleading.

like image 54
Allov Avatar answered Sep 19 '22 13:09

Allov


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

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:

  • 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.

--

Edit: 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.

like image 23
Portman Avatar answered Sep 18 '22 13:09

Portman