# MS-SQL 쿼리 로그 보기(쿼리문)
select db_name(st.dbid) I3_IC ,
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
where creation_time >= '2012-01-01 00:00:00'
--and db_name(st.dbid) is not null and cp.objtype = 'proc' --조건: 종류
and text like '%delete%'
order by last_execution_time desc;