Find the Which Query is Run the Last Time in Sql Server
-
Saturday, July 21, 2012 5:22 AM
Using below mentioned query to Achive it,
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
- Changed Type BalmukundMicrosoft Employee, Moderator Monday, July 23, 2012 7:33 AM not a discussion type post
All Replies
-
Saturday, July 21, 2012 8:46 AM
copy from Pinel Dave
http://blog.sqlauthority.com/2008/01/03/sql-server-2005-last-ran-query-recently-ran-query/
not very friendly to copy code from other people without mentioning the source.
besides that facts where is the context to SQL Server Security ?
- Edited by Daniel_Steiner Saturday, July 21, 2012 8:47 AM
-
Monday, July 23, 2012 7:14 AM
Hai Daniel_Steiner,
Yes i find this code from SQL Authority, But i need is Who Run the code last time for the particluar procedure ?

