<?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>Sqlserver007 &#187; dmv</title>
	<atom:link href="http://www.sqlserver007.com/tag/dmv/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sqlserver007.com</link>
	<description>Blog on SQL SERVER and Business Intelligence  by Vivekanand Serou</description>
	<lastBuildDate>Fri, 21 May 2010 11:37:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Playing with SQL SERVER CACHE</title>
		<link>http://www.sqlserver007.com/2009/06/16/playing-with-sql-server-cache/</link>
		<comments>http://www.sqlserver007.com/2009/06/16/playing-with-sql-server-cache/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 10:46:28 +0000</pubDate>
		<dc:creator>Vivek</dc:creator>
				<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[TSQL Development]]></category>
		<category><![CDATA[dmv]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.sqlserver007.com/?p=161</guid>
		<description><![CDATA[Yesterday Afternoon me and my friend were doing some serious Sql manipulation on some heavy datasets that needs to go inside the Cube.We have written some dynamic SQL statement that is going to insert some 40000 rows into a Control table for a Dimension. Weird Enough my friend accidently closed the Query window and for [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday Afternoon me and my friend were doing some serious Sql manipulation on some heavy datasets that needs to go inside the Cube.We have written some dynamic SQL statement that is going to insert some 40000 rows into a Control table for a Dimension.<br />
Weird Enough my friend accidently closed the Query window and for a second we thought we lost it.</p>
<p>But Thanks to Dynamic Management views(DMV) from Sql server 2005.we were able to get the query back from the Cache..The query we used is as follows</p>
<p><strong>select qs.usecounts, cacheobjtype, objtype, qt.text<br />
from sys.dm_exec_cached_plans qs<br />
cross apply sys.dm_exec_sql_text(qs.plan_handle) as qt<br />
&#8211;where qt.text like &#8216;%%&#8217;<br />
order by qt.text</strong></p>
<p>and thats it we were able to get back the query&#8230;quite cool way of doing things..isnt it?</p>
<p><!-- Begin: AdBrite, Generated: 2009-07-06 10:04:17  --><br />
<script type="text/javascript">
var AdBrite_Title_Color = '000000';
var AdBrite_Text_Color = '000000';
var AdBrite_Background_Color = 'FFFFFF';
var AdBrite_Border_Color = 'CCCCCC';
var AdBrite_URL_Color = '008000';
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';}
</script><br />
<span style="white-space:nowrap;"><script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=1247725&#038;zs=3436385f3630&#038;ifr='+AdBrite_Iframe+'&#038;ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script><br />
<a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=1247725&#038;afsid=1"><img src="http://files.adbrite.com/mb/images/adbrite-your-ad-here-banner.gif" style="background-color:#CCCCCC;border:none;padding:0;margin:0;" alt="Your Ad Here" width="11" height="60" border="0" /></a></span><br />
<!-- End: AdBrite --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlserver007.com/2009/06/16/playing-with-sql-server-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
