Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: SQL
Posted by: Stefan Wendelmann
Added: Apr 30, 2019 11:21 AM
Views: 17
Tags: no tags
  1. SELECT        SQLTEXT.text, STATS.last_execution_time
  2. FROM          sys.dm_exec_query_stats STATS
  3. CROSS APPLY   sys.dm_exec_sql_text(STATS.sql_handle) AS SQLTEXT
  4. WHERE         STATS.last_execution_time > GETDATE()-1
  5. ORDER BY      STATS.last_execution_time DESC