Using below query you can get executed time and query text
SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC
Results of above query
Using below query you can find the Recently excuted query for specific SPID
SELECT SDEC.[most_recent_sql_handle], DEST.[text], last_read, Last_write
FROM sys.[dm_exec_connections] SDEC
CROSS APPLY sys.[dm_exec_sql_text](SDEC.[most_recent_sql_handle]) AS DEST
WHERE SDEC.[most_recent_session_id] = 52
Results of above query
Thanks
Venkat Sangu
No comments:
Post a Comment