How to find the last run date of a stored procedure

Former Member
Former Member $organization

 

Hi all,

Through the conference grapevine a colleague of mine mentioned someone wanted to know how to find out the last run date of a procedure. I figured this was the most appropriate place to post it so here it is:

 

Select

      b.name,

      a.last_execution_time

From

      sys.dm_exec_procedure_stats a

      join sys.objects b on a.object_id = b.object_id

Where

      b.name like 'STORED_PROCEDURE_NAME'

 

These views are in the Master database. For anyone just discovering this, there are so many useful views in there…I know when I leant about these little gems I was VERY happy!! 

Natasha 

 



[edited by: Natasha Purkiss at 11:28 AM (GMT -6) on 29 Aug 2012] Sorry guys, I had '=' instead of 'like' in the where clause.
Parents Reply Children
No Data