SELECTtop100 st.textas sql_statement,
qs.creation_time as plan_last_compiled,
qs.last_execution_time as plan_last_executed,
qs.execution_count as plan_executed_count,
qp.query_plan
FROM sys.dm_exec_query_stats qs
CROSSAPPLY sys.dm_exec_sql_text(qs.plan_handle) st
CROSSAPPLY sys.dm_exec_query_plan(qs.plan_handle) qp
where st.textlike'%delete%'orderby plan_last_compiled desc
sqlserver 行号使用(row_number)
语法:ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN)