Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a list of recently added stored procs from SQL Server database

Is it possible to get a list of stored procs from a SQL Server database where created/last updated date > yesterday?

sys.sql_modules does not seem to have a date. It must be stored somewhere else.

like image 503
Alex J Avatar asked Aug 24 '11 17:08

Alex J


2 Answers

This will list all of the stored procedures along with their creation and modified dates:

SELECT name, modify_date
FROM sys.objects
WHERE type = 'P'
  AND modify_date >= DATEADD(Day, -1, CONVERT(Date, GETDATE()))
ORDER BY modify_date DESC;

EDIT: Since modify_date will always be equal to or after create_date... Also note that you could just use sys.procedures as another answer mentioned.

like image 95
Yuck Avatar answered Apr 29 '23 12:04

Yuck


sys.procedures contains create_date and modify_date

like image 45
Remus Rusanu Avatar answered Apr 29 '23 13:04

Remus Rusanu