List all Views modified in last N days in a SQL Server Database
USE Database_Name
SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'V'
AND DATEDIFF(D,modify_date, GETDATE()) < 10
Following script will list all the views which were created in last 10 days in a database, no matter if they were modified after that or not:
USE Database_Name
SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'V'
AND DATEDIFF(D, create_date, GETDATE()) < 10
For views that were never modified after creation, the modified date and create date are the same.
No comments:
Post a Comment