Christian de Bellefeuille
asked on
View last queries on a database?
Is it possible to view an MS-SQL Server last 10 queries on a specific database or table? and how? (I'm using MS-SQL Server Express 2016).
I've seen this code on SO but it doesn't show every calls, and not for a long time. If i run the same query again, some rows of the previous result doesn't show anymore:
Do i have to set a flag to keep a trace somewhere?
Thanks you
I've seen this code on SO but it doesn't show every calls, and not for a long time. If i run the same query again, some rows of the previous result doesn't show anymore:
SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE dest.dbid = DB_ID('MyDB')
ORDER BY deqs.last_execution_time DESC
Do i have to set a flag to keep a trace somewhere?
Thanks you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER