Listing the Most Recently Executed Queries in SQL Server

Hello everyone,

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.

Listing the Most Recently Executed Queries in SQL Server

As you can see, the most recently executed queries are listed.

Good luck to everyone in business and life.

177 Views

Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!