MSSQLWIKI

Karthick P.K on SQL Server

Script to get all the Query and cached plans

Posted by Karthick P.K on February 18, 2009

 

 

SELECT

    *

 FROM sys.dm_exec_cached_plans cp

 

  CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle) eqp

 

  CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) est

 

 --WHERE   est.dbid = DB_ID('DBNMAE')

One Response to “Script to get all the Query and cached plans”

  1. […] Script to get all the Query and cached plans […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: