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
Check Recent Execute Procedures Name
Ashish Srivastava
May 23
2016
Code
699
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Query:
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);
Output:
SQL Server
Recent Execute Procedures