Find plan_handle

  • Hi - If I know the executing query whats the best way to get the plan_handle such that I can look at the plan in the plan cache?

    Thanks

  • Have figured it out by using this query:

    SELECT UseCounts, Cacheobjtype, Objtype, TEXT, query_plan, plan_handle

    FROM sys.dm_exec_cached_plans

    CROSS APPLY sys.dm_exec_sql_text(plan_handle)

    CROSS APPLY sys.dm_exec_query_plan(plan_handle)

    WHERE TEXT like '%%'

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply