ab SQL Server 2005
1 2 3 4 |
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 |
SQL Server 2005
1 2 3 4 5 6 7 8 9 |
Use master SELECT execquery.last_execution_time AS [Date Time], execsql.text AS [Script] ,* FROM sys.dm_exec_query_stats AS execquery CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql --WHERE CONVERT(VARCHAR(MAX),execsql.text) LIKE '%Truncate%' ORDER BY total_elapsed_time,execquery.last_execution_time DESC |
Login