查询SQL时间段内执行过的哪些SQL语句
时间:2021-07-01 10:21:17
帮助过:41人阅读
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 ‘2019-08-24 11:27:16‘ AND ‘2019-08-24 18:00:00‘ AND ST.
text LIKE ‘%emw_skzy101..M_WMS_SU_HIS%‘
ORDER BY QS.creation_time
DESC
查询SQL时间段内执行过的哪些SQL语句
标签:时间 color ike handle oss nbsp class sel worker