原文链接:https://blog.csdn.net/qq_40763549/article/details/122229169
select top 1000 [QS].[creation_time], substring( [ST].[text], ([QS].[statement_start_offset] / 2) + 1, ( (case [QS].[statement_end_offset] when - 1 then datalength([st].[text]) else [QS].[statement_end_offset] end - [QS].[statement_start_offset]) / 2 ) + 1 ) as [statement_text], [ST].[text], [QS].[total_worker_time], [QS].[last_worker_time], [QS].[max_worker_time], [QS].[min_worker_time] from [sys].[dm_exec_query_stats] [QS] cross apply [sys].[dm_exec_sql_text]([QS].[sql_handle]) [ST] -- 时间段设置 where [QS].[creation_time] between '2021-12-10 00:00:00' and '2021-12-29 23:59:00' -- SQL 语句模糊匹配,如insert、SELECT、UPDATE、DELETE and [ST].[text] like '%DELETE%' order by [QS].[creation_time] desc
标签:历史记录,QS,改动,text,SqlServer,00,statement,time,worker From: https://www.cnblogs.com/Dongmy/p/18496090