<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Server with Mr. Denny &#187; sys.plan_guides</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/sql-server/tag/sysplan_guides/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/sql-server</link>
	<description></description>
	<lastBuildDate>Mon, 10 Jun 2013 17:25:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Viewing SQL Server Plan Guides</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/viewing-sql-server-plan-guides/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/viewing-sql-server-plan-guides/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 15:00:06 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Plan Guides]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[sys.plan_guides]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=280</guid>
		<description><![CDATA[So you&#8217;ve saved a plan guide into your SQL server, and you want to look at the plan.  You can Query the sys.plan_guides catalog view and see the data exactly as you entered it, which works fine if you just have a hint in there.  But if you have a full XML query plan that [...]]]></description>
				<content:encoded><![CDATA[<p>So you&#8217;ve saved a plan guide into your SQL server, and you want to look at the plan.  You can Query the sys.plan_guides catalog view and see the data exactly as you entered it, which works fine if you just have a hint in there.  But if you have a full XML query plan that isn&#8217;t going to do you a lot of good since SSMS isn&#8217;t going to want to show you the all the XML as it is probably longer than it wants to display.</p>
<p>This little query should help you with that.  You may need adjust it slightly to account for extra spaces in your plan guide, I tried to account for double spaces, but if you have more than two spaces anywhere in the top part you&#8217;ll need to tweak it.</p>
<p><span id="more-280"></span><code>select cast(replace(replace(replace(hints, '  ', ' '), 'OPTION (USE PLAN N''', ''), ''')', '') as xml), *<br />
from sys.plan_guides</code></p>
<p>This will give you XM that you can click on, which should open right up in SSMS as a query plan (if using SQL Server 2008, if you are using the SQL 2005 SSMS you&#8217;ll need to save the XML file and rename it to *.sqlplan and open it in SSMS).</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/viewing-sql-server-plan-guides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
