본문 바로가기
개발자 이야기/SQL

[inquire SQL history] inquire excuted query history #inquire #history

by - 하루살이 - 2022. 6. 14.
728x90
반응형

-- Microsoft SQL Server Management Studio에서 직접 실행했던 쿼리들만 보여준다.

SELECT
db_name(st.dbid) DBName,
object_schema_name(objectid, st.dbid) SchemaName,
object_name(objectid, st.dbid) SPName,
qs.total_elapsed_time,
creation_time,
last_execution_time,
text
FROM
sys.dm_exec_query_stats qs
CROSS APPLY
sys.dm_exec_sql_text(qs.plan_handle)st
JOIN
sys.dm_exec_cached_plans cp
ON
qs.plan_handle = cp.plan_handle

728x90
반응형

댓글