Created
November 11, 2013 07:36
-
-
Save ChauThan/7409306 to your computer and use it in GitHub Desktop.
Get last execution of store procedured
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CASE PS.database_id | |
WHEN 32767 | |
THEN 'Resource DB' | |
ELSE DB_NAME(PS.database_id) | |
END AS [DB Name] | |
,OBJECT_NAME(PS.object_id, PS.database_id) AS [SP Name] | |
,PS.last_execution_time AS [Last Executed] | |
,PS.execution_count AS [# runs] | |
FROM sys.dm_exec_procedure_stats PS | |
ORDER BY DB_NAME(PS.database_id) | |
,PS.last_execution_time DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment