<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Find Recently Executed Stored Procedures</title>
	<atom:link href="http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/</link>
	<description>Self-Professed SQL Scripting Junkie!</description>
	<lastBuildDate>Fri, 04 May 2012 08:30:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Michelle Ufford</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4892</link>
		<dc:creator>Michelle Ufford</dc:creator>
		<pubDate>Wed, 19 Aug 2009 01:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4892</guid>
		<description>@Kiran I can&#039;t really give you a good answer.  It really depends on your server, i.e. how much activity is going on, how much available memory you have, etc.  If I had to take a wild guess, I would say you&#039;re looking at anywhere from 1 to 5 days, depending on the specifics of your environment.</description>
		<content:encoded><![CDATA[<p>@Kiran I can&#8217;t really give you a good answer.  It really depends on your server, i.e. how much activity is going on, how much available memory you have, etc.  If I had to take a wild guess, I would say you&#8217;re looking at anywhere from 1 to 5 days, depending on the specifics of your environment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kiran</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4882</link>
		<dc:creator>Kiran</dc:creator>
		<pubDate>Mon, 10 Aug 2009 13:41:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4882</guid>
		<description>Do you know how long the procedure calls remain in cache, approximately? Like, are we talking a few hours, or a few days, or a few weeks?</description>
		<content:encoded><![CDATA[<p>Do you know how long the procedure calls remain in cache, approximately? Like, are we talking a few hours, or a few days, or a few weeks?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Something for the weekend: SQL Server Links 07/08/09 &#124; John Sansom - SQL Server DBA in the UK</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4879</link>
		<dc:creator>Something for the weekend: SQL Server Links 07/08/09 &#124; John Sansom - SQL Server DBA in the UK</dc:creator>
		<pubDate>Fri, 07 Aug 2009 13:26:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4879</guid>
		<description>[...] Find Recently Executed Stored Procedures &#8211; Nice tip. [...]</description>
		<content:encoded><![CDATA[<p>[...] Find Recently Executed Stored Procedures &#8211; Nice tip. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthieu</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4876</link>
		<dc:creator>Matthieu</dc:creator>
		<pubDate>Wed, 05 Aug 2009 07:19:09 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4876</guid>
		<description>Thanks for your answer.

It&#039;s working fine. I just missed something at the beginning. I was running the query outside the MASTER DB.  Oups.

Thx</description>
		<content:encoded><![CDATA[<p>Thanks for your answer.</p>
<p>It&#8217;s working fine. I just missed something at the beginning. I was running the query outside the MASTER DB.  Oups.</p>
<p>Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Horninger</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4874</link>
		<dc:creator>Mark Horninger</dc:creator>
		<pubDate>Tue, 04 Aug 2009 17:04:48 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4874</guid>
		<description>Pretty good article!  Gotta love what you can do with the DMV&#039;s</description>
		<content:encoded><![CDATA[<p>Pretty good article!  Gotta love what you can do with the DMV&#8217;s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michelle Ufford</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4871</link>
		<dc:creator>Michelle Ufford</dc:creator>
		<pubDate>Tue, 04 Aug 2009 13:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4871</guid>
		<description>@Matthieu  You need to be on SQL Server 2005 SP2 or higher.  In prior versions of SQL Server, the OBJECT_NAME function only accepts a parameter for object_id.  You can read more about this here:  http://msdn.microsoft.com/en-us/library/ms186301(SQL.90).aspx

To make this work for you, you could try the following query:

&lt;pre lang=&quot;tsql&quot;&gt;
SELECT DB_NAME(dest.[dbid]) AS &#039;databaseName&#039;
    , OBJECT_NAME(dest.objectid) AS &#039;procName&#039;
    , MAX(deqs.last_execution_time) AS &#039;last_execution&#039;
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE dest.[TEXT] LIKE &#039;%yourTableName%&#039; -- replace
    And dest.[dbid] = DB_ID()  -- exclude ad-hocs
GROUP BY DB_NAME(dest.[dbid])
    , OBJECT_NAME(dest.objectid)
ORDER BY databaseName
    , procName
OPTION (MaxDop 1);
&lt;/pre&gt;

then execute it for each database.</description>
		<content:encoded><![CDATA[<p>@Matthieu  You need to be on SQL Server 2005 SP2 or higher.  In prior versions of SQL Server, the OBJECT_NAME function only accepts a parameter for object_id.  You can read more about this here:  <a href="http://msdn.microsoft.com/en-us/library/ms186301(SQL.90).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms186301(SQL.90).aspx</a></p>
<p>To make this work for you, you could try the following query:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">SELECT</span> <span style="color: #FF00FF;">DB_NAME</span><span style="color: #808080;">&#40;</span>dest.<span style="color: #808080;">&#91;</span>dbid<span style="color: #808080;">&#93;</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'databaseName'</span>
    , <span style="color: #FF00FF;">OBJECT_NAME</span><span style="color: #808080;">&#40;</span>dest.<span style="color: #202020;">objectid</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'procName'</span>
    , <span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#40;</span>deqs.<span style="color: #202020;">last_execution_time</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'last_execution'</span>
<span style="color: #0000FF;">FROM</span> sys.<span style="color: #202020;">dm_exec_query_stats</span> <span style="color: #0000FF;">AS</span> deqs
<span style="color: #808080;">CROSS</span> APPLY sys.<span style="color: #202020;">dm_exec_sql_text</span><span style="color: #808080;">&#40;</span>deqs.<span style="color: #202020;">sql_handle</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> dest
<span style="color: #0000FF;">WHERE</span> dest.<span style="color: #808080;">&#91;</span><span style="color: #0000FF;">TEXT</span><span style="color: #808080;">&#93;</span> <span style="color: #808080;">LIKE</span> <span style="color: #FF0000;">'%yourTableName%'</span> <span style="color: #008080;">-- replace</span>
    And dest.<span style="color: #808080;">&#91;</span>dbid<span style="color: #808080;">&#93;</span> <span style="color: #808080;">=</span> <span style="color: #FF00FF;">DB_ID</span><span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span>  <span style="color: #008080;">-- exclude ad-hocs</span>
<span style="color: #0000FF;">GROUP</span> <span style="color: #0000FF;">BY</span> <span style="color: #FF00FF;">DB_NAME</span><span style="color: #808080;">&#40;</span>dest.<span style="color: #808080;">&#91;</span>dbid<span style="color: #808080;">&#93;</span><span style="color: #808080;">&#41;</span>
    , <span style="color: #FF00FF;">OBJECT_NAME</span><span style="color: #808080;">&#40;</span>dest.<span style="color: #202020;">objectid</span><span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span> databaseName
    , procName
<span style="color: #0000FF;">OPTION</span> <span style="color: #808080;">&#40;</span>MaxDop <span style="color: #000;">1</span><span style="color: #808080;">&#41;</span>;</pre></div></div>

<p>then execute it for each database.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthieu</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4870</link>
		<dc:creator>Matthieu</dc:creator>
		<pubDate>Tue, 04 Aug 2009 07:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4870</guid>
		<description>Hello, 
I can&#039;t make this script work on sql server 2005.
The following error appears (I translate it from french) : 

Msg 174, Level 15, State 1, Line 2
La fonction object_name requiert 1 argument(s).
=&gt;
Msg 174, Level 15, State 1, Line 2
object_name function require 1 argument(s).

Do you know what is this ?
Thanks by advance,</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I can&#8217;t make this script work on sql server 2005.<br />
The following error appears (I translate it from french) : </p>
<p>Msg 174, Level 15, State 1, Line 2<br />
La fonction object_name requiert 1 argument(s).<br />
=&gt;<br />
Msg 174, Level 15, State 1, Line 2<br />
object_name function require 1 argument(s).</p>
<p>Do you know what is this ?<br />
Thanks by advance,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SqlServerKudos</title>
		<link>http://sqlfool.com/2009/08/find-recently-executed-stored-procedures/comment-page-1/#comment-4867</link>
		<dc:creator>SqlServerKudos</dc:creator>
		<pubDate>Mon, 03 Aug 2009 16:20:17 +0000</pubDate>
		<guid isPermaLink="false">http://sqlfool.com/?p=1120#comment-4867</guid>
		<description>&lt;strong&gt;Find Recently Executed Stored Procedures...&lt;/strong&gt;

Kudos for a great Sql Server article - Trackback from SqlServerKudos...</description>
		<content:encoded><![CDATA[<p><strong>Find Recently Executed Stored Procedures&#8230;</strong></p>
<p>Kudos for a great Sql Server article &#8211; Trackback from SqlServerKudos&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

