We can find recent queries from cache by using below query:
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
Once SQL Server restarted or clear the cache using DBCC, all the statements will be gone.
No comments:
Post a Comment