Been ages since ive posted on here as ive been in a cave working on a big project!  Ive finally come out and found time to post something useful i found.
I wanted to know what had changed in a database in the last x days to check for things before i did a backup/restore so found the following queries useful!
This fella will tell you the stored procedures that have been modified in the last x days:
SELECT NAME ProcName, create_date Created, modify_date Modified 
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 3 --Change 7 to any other day value
ORDER BY 3 DESC 
This fella will tell you the stored procedures that have been created in the last x days:
SELECT NAME ProcName, create_date Created, modify_date Modified 
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 3 
ORDER BY 2 DESC 
Very handy!
Wednesday, 5 March 2008
Find out what stored procs have changed
Posted by
Omen
at
11:59
 
Labels: SQL Server 2005, SQL Server 2008
 
Subscribe to:
Post Comments (Atom)

1 comment:
Wow that is very useful. I'm constantly making changes to stored procs and forgetting what I changed. I'll have to put these to good use.
Post a Comment