List all Views modified in last N days in a SQL Server Database

To list all views that were changed recently in a database, for example in the last 10 days, run the following script:

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.

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">