Saturday, August 6, 2011

SQL Server 2005-When a stored procedure, table or view was last modified


In SQL Server 2005 we can find out when table, view or stored procedure was last modified. This functionality was not available in previous versions of SQL server

--Store procedure last modified
SELECT * From information_schema.routines
--Stored modified within last 7 days

select DATEDIFF(d,LAST_ALTERED,GetDate()),* from information_schema.routines WHERE DATEDIFF(d,LAST_ALTERED,GetDate())<=7

--table last modified
SELECT [name], create_date, modify_date FROM sys.tables
--View last modified

SELECT [name], create_date,modify_date FROM sys.views

No comments:

Post a Comment

Open default email app in .NET MAUI

Sample Code:  if (Email.Default.IsComposeSupported) {     string subject = "Hello!";     string body = "Excellent!";    ...