T-SQL: Recently Executed Query

by Prashant 14. October 2009 14:16

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
Share or Bookmark this post…
  • Live
  • Facebook
  • TwitThis
  • del.icio.us
  • Digg
  • DZone
  • Technorati
  • StumbleUpon
  • Google
  • E-Mail

If you enjoyed this post, make sure you subscribe to my RSS feed!

Tags: ,

SQL Server | T-SQL

Comments are closed

Powered by BlogEngine.NET 1.5.0.7
Visit blogadda.com to discover Indian blogs

About

Name of authorMy name is Prashant Khandelwal. I am a .NET programmer and technology enthusiast from New Delhi, India.

       

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2010

Creative Commons License