Have you ever wanted to find out the last time a stored procedure was executed, if ever? Here is a T-SQL snippet that will return the date and time of the last execution of the list of stored procedures provided in a the WHERE clause listed. It will return NULL for those stored procedures that have never been executed.
1 2 3 4 5 6 7 8 9 |
SELECT syso.name, dmv_eps.last_execution_time FROM sys.dm_exec_procedure_stats dmv_eps RIGHT JOIN sys.objects syso ON syso.[object_id] = dmv_eps.[object_id] WHERE syso.name IN ('usp_sproc1', 'usp_sproc2', 'usp_sproc3') ORDER BY syso.name GO |
Views – 1828