Is there a way to find out from system tables when the store procedure was changed last?

Filed under: Administration, I'm a Newbie, Internals and Architecture, SQL Server 2005, Transact-SQL (T-SQL) — Ari Weil at 1:22 pm on Friday, August 29, 2008

Absolutely. You can use the sys.objects view to determine the create_date and modify_date for an object. The query would be:


select [name],[create_date],[modify_date]
from [sys].[objects]
where [type]=N’P’ and [is_ms_shipped]=0

To see the full definition of the procedure you would run:


select [name],[create_date],[modify_date],[definition]
from [sys].[objects] obj
join [sys].[sql_modules] mod
on obj.[object_id]=mod.[object_id]
where [type]=N’P’ and [is_ms_shipped]=0

1 Comment »

Comment by David Gugick

August 29, 2008 @ 1:50 pm

Make sure to use ALTER PROCEDURE instead of DROP PROC/CREATE PROC when updating your procedures or you will reset the object id for the stored procedure and lose the original create date.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>