sqlserver 查询指定表操作记录

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 '2020-11-10 00:00:00' AND '2020-11-17 00:00:00'
-- AND ST.text NOT LIKE '%SELECT * FROM T_LOCATIONINFO WHERE STRCLIPLOGICID in(%'
AND ST.text LIKE '%Txj_web_user_record%'
ORDER BY
QS.creation_time DESC

 

表名 Txj_web_user_record

时间范围:QS.creation_time BETWEEN '2020-11-10 00:00:00' AND '2020-11-17 00:00:00'

 

执行效果:

 

posted @ 2020-11-16 10:05  官萧何  阅读(255)  评论(0编辑  收藏