SQL SERVER –Query To Find Recently Executed T-SQL Query

Here is the sql query that will return  recently executed T-SQL query on database.


SELECT QS.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS QS
CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) AS dest
ORDER BY QS.last_execution_time DESC                                                                                                                                     
                                                                                    
Tags: , ,

Join Us!