How to see when stored procedures have last run

Posted by Brandon Moore on Server Fault See other posts from Server Fault or by Brandon Moore
Published on 2012-06-05T19:25:52Z Indexed on 2012/06/06 4:42 UTC
Read the original article Hit count: 471

Filed under:

I want to see a listing of all the stored procs for each database on a server along with when the last time that store proc was run. I'm pretty good with SQL but I don't know about looking at stats like this that sql keeps so I'd appreciate a little help finding this info.

EDIT:

From the answers I'm getting it sounds like this is not possible the way I thought it would be. I was thinking that it could be done similarly to how you can see when a table was last accessed:

select  t.name, user_seeks, user_scans, user_lookups, user_updates, 
        last_user_seek, last_user_scan, last_user_lookup, last_user_update

from    sys.dm_db_index_usage_stats i JOIN
        sys.tables t ON (t.object_id = i.object_id)

where   database_id = db_id()

The above script was stolen from a comment on http://blog.sqlauthority.com/2009/05/09/sql-server-find-last-date-time-updated-for-any-table/.

© Server Fault or respective owner

Related posts about sql-server-2008