可能重复:
How to see query history in SQL Server Management Studio
我想以某种方式获取SQL Server 2008 R2上已执行查询的历史记录。假设我运行查询:
DELETE FROM TABLE
是否记录在某个地方?我可以看到在服务器上执行的查询吗?
我想检查某个存储过程或任何其他自动化任务是否在特定时间执行。
答案 0 :(得分:2)
this 会帮忙吗?
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
并按照anio How to see query history in SQL Server Management Studio
的指示