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

How to upload app to macOS

1. Open Terminal Press Cmd (⌘) + Space , type Terminal , and hit Enter . 2. Navigate to Your Build Output Directory Your .app file is likel...