Tuesday, March 11, 2008

SQL Thief - Last Modified Stored Procs

I will admit that what I am about to put here, I stole from Pinal Dave's site. Nonetheless, I use these scripts quite frequently, but have a hard time finding them on line (you have to remember just the right search word, and I always forget to bookmark them). So for my quick reference

Here's how to get a list of all stored procedures modified in the last x days


SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7 --Change 7 to any other day value.



The following script will provide name of all the stored procedure which were created in last 7 days, they may or may not be modified after that.


SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 7 --Change 7 to any other day value

No comments: