TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Last Execute Procedures Check
Ashish Srivastava
Dec 19
2015
Code
762
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
SELECT
DB_Name(SqlTxt.[dbid])
AS
[
Database
]
, Object_Name(SqlTxt.objectid, SqlTxt.[dbid])
AS
[Stored
Procedure
]
,
Max
(stat.last_execution_time)
As
[
Last
Executed
Time
]
FROM
sys.dm_exec_query_stats
AS
stat
CROSS
APPLY sys.dm_exec_sql_text(stat.sql_handle)
AS
SqlTxt
INNER
JOIN
sys.procedures SP
ON
SP.object_id = SqlTxt.objectid
AND
SqlTxt.[dbid]
IS
NOT
NULL
GROUP
BY
db_name(SqlTxt.[dbid])
, Object_Name(SqlTxt.objectid, SqlTxt.[dbid])
ORDER
BY
1, 2
OPTION
(MAXDOP 1);
Query Output:
Execute Procedures
SQL