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

If you’re using Visual Studio to build your .NET MAUI app on a Mac, locating the IPA (iOS App Package) file can be a bit tricky

  If you’re using   Visual Studio   to build your   .NET MAUI   app on a   Mac , locating the   IPA (iOS App Package)   file can be a bit tr...