T-SQL: Recently Executed Query

14. October 2009 05:16

SQL Server T-SQL  0 Comments

I am a regular reader of Pinal Dave's blog SqlAuthority. I always found something new in his blog to work with SQL Server. Here is something I would like to share: Get the recent executed SQL Queries from SQL Server.

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 destORDER BY deqs.last_execution_time DESC
 No Rating

Comments (0)

Add Comment

Visit blogadda.com to discover Indian blogs Computers Blogs