Skip to content

Instantly share code, notes, and snippets.

@richardbasile
Created February 16, 2018 14:49
Show Gist options
  • Select an option

  • Save richardbasile/8e188e7081e42db9eeb09601e65c1721 to your computer and use it in GitHub Desktop.

Select an option

Save richardbasile/8e188e7081e42db9eeb09601e65c1721 to your computer and use it in GitHub Desktop.
SQL Server - Execution Plan
SELECT st.text, qs.*, qp.*
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
cross apply sys.dm_exec_query_plan(plan_handle) qp
WHERE CONVERT(date, last_execution_time) = CONVERT(date, getdate())
AND st.text like '%<snippet>%' -- change this value
AND st.text not like '%e971a5bc-cd6c-4465-9232-2cb419163112%'
order by creation_time desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment