Friday 19 April 2013

List all Stored Procedures modified in last N days in a SQL Server Database

To list all stored procedures 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 = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 10

Following script will list all the stored procedures 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 = 'P'
AND DATEDIFF(D, create_date, GETDATE()) < 10

No comments:

Post a Comment