Search

Tuesday, August 7, 2012

View recently run queries

Use below query to get recently run queries

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

No comments:

Post a Comment