Tuesday, January 27, 2009

SQL Server 2005 - View Executed SQL Queries

How to view queries run on SQL Server 2005:
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


Source: SQL SERVER - 2005 - Last Ran Query - Recently Ran Query

No comments: