Created
May 10, 2018 18:40
-
-
Save cbmeeks/3f3717685564b8b32a3b7a6686cce587 to your computer and use it in GitHub Desktop.
List stored procedures and when they were last run
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 | |
sc.name, p.name, st.last_execution_time | |
FROM sys.procedures AS p | |
INNER JOIN sys.schemas AS sc ON p.[schema_id] = sc.[schema_id] | |
LEFT OUTER JOIN sys.dm_exec_procedure_stats AS st ON p.[object_id] = st.[object_id] | |
ORDER BY | |
p.name, st.last_execution_time DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment