SQL SERVER - 2005 - Last Ran Query - Recently Ran Query
Posted by: Journey to SQL Authority with Pinal Dave,
on 03 Jan 2008 |
View original | Bookmarked: 0 time(s)
How many times we have wondered what were the last few queries ran on SQL Server? Following quick script demonstrates last ran query along with the time it was executed on SQL Server 2005.SELECT deqs.last_execution_time AS [Time], dest.text AS [Query]FROM sys.dm_exec_query_stats AS deqsCROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS destORDER BY deqs.last_execution_time DESCReference : Pinal Dave (http://www.SQLAuthority.com), BOL [...]...