Listing the Most Recently Executed Queries in SQL Server
In this article, I will provide information about listing the most recently executed queries in SQL Server.
In SQL Server, in some cases, we may want to see the last queries we ran.
You can get information about the most recently run queries using the query below.
SELECT deqs.last_execution_time AS [Tarih], dest.text AS [Sorgu] 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;
When you run the query you will get the following result.
As you can see, the most recently executed queries are listed.
Good luck to everyone in business and life.