Monday, May 31, 2010

How to retrieve parameter value from Saved Execution Plan


When you save the query execution plan to analyze later. You can get the parameter values passed for that execution either from XML plan or Query Plan properties.


To get the parameter values through xml plan …

Right click on LEFTMOST operator of the query plan (in my case it is SELECT)
Select “Shoe Execution Plan XML…” option
Find “<ParameterList>”
There you will find the parameter with their run time value. (as shown below)



To get the parameter values through property window…
Right click on LEFTMOST  operator of the query plan (in my case it is SELECT)
Select ‘Properties’
Find ‘Parameter List’ attribute
Expand the attribute to get the parameter along with its runtime value. (as shown below)



Also notice that you will find the Set Options in Properties window and StatementSetOptions element in XML query plan, that will describe the environmental variable state in which plan was generated.

-Sajid

No comments:

Post a Comment