查询SQLSERVER执行过的SQL记录(测试通过)
仅支持SQL SERVER2008及以上版本
SELECT TOP 1000 --创建时间 QS.creation_time, --执行文本 ST.text FROM sys.dm_exec_query_stats QS --关键字 CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) ST WHERE QS.creation_time BETWEEN '2019-02-03 09:00:00' AND '2019-02-03 16:11:00' AND ST.text NOT LIKE '%SELECT * FROM T_LOCATIONINFO WHERE STRCLIPLOGICID in(%' ORDER BY QS.creation_time DESC