Thursday 11 May 2017

Get executed queries history Sql

SELECT  deqs.last_execution_time,dest.text
FROM    sys.dm_exec_query_stats AS deqs
        CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE   deqs.last_execution_time > '05/11/2017 11:00' -- check date
        AND dest.text LIKE '%querytomatch%' -- optional
        AND dest.dbid = DB_ID('dbname')
        order by deqs.last_execution_time desc

No comments:

Post a Comment

What should you required to learn machine learning

  To learn machine learning, you will need to acquire a combination of technical skills and domain knowledge. Here are some of the things yo...