Tuesday, December 28, 2010

How to find the recently modified stored procedures.

Working with offshore resources can be a daunting task at times. We need to take care of what has been modified and move it across environments. This neat script will do the trick for ya.

SELECT name as 'Name' ,create_date as 'Date Created',modify_date as 'Date Modified',
Case DATEDIFF(dd,modify_date,GETDATE()) when '0' Then 'Today'
when '1' Then 'Yesterday'
when '2' Then 'Day before Yesterday'
else 'Few days back'
End AS 'When modified',
DATEDIFF(dd,modify_date,GETDATE()) as 'How days days back'

FROM sys.procedures
WHERE DATEDIFF(dd,modify_date,GETDATE()) < 15
order by modify_date desc

No comments:

Post a Comment