<?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: A Stored Procedure to Launch a SQL Agent Job and Wait</title>
	<atom:link href="http://blog.boxedbits.com/archives/124/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.boxedbits.com/archives/124</link>
	<description>( ... more specifically about BI with Microsoft products )</description>
	<lastBuildDate>Wed, 01 Feb 2012 21:00:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Event Driven SSIS with Synchronous Processing and Dynamic Subscriptions &#171; Garrett Edmondson</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3603</link>
		<dc:creator>Event Driven SSIS with Synchronous Processing and Dynamic Subscriptions &#171; Garrett Edmondson</dc:creator>
		<pubDate>Wed, 12 Oct 2011 17:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3603</guid>
		<description>[...] can be  synchronous by simply adding this code to a  stored procedure that calls [...]</description>
		<content:encoded><![CDATA[<p>[...] can be  synchronous by simply adding this code to a  stored procedure that calls [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3549</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Wed, 23 Feb 2011 17:19:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3549</guid>
		<description>This post helped me alot! Thanks all.

To Max,

Can you post the complete stored procedure.

Thanks</description>
		<content:encoded><![CDATA[<p>This post helped me alot! Thanks all.</p>
<p>To Max,</p>
<p>Can you post the complete stored procedure.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Awesome</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3541</link>
		<dc:creator>Max Awesome</dc:creator>
		<pubDate>Fri, 21 Jan 2011 04:06:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3541</guid>
		<description>Oop! Typo! In my above post, it should read:

SET @running=1</description>
		<content:encoded><![CDATA[<p>Oop! Typo! In my above post, it should read:</p>
<p>SET @running=1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Awesome</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3540</link>
		<dc:creator>Max Awesome</dc:creator>
		<pubDate>Fri, 21 Jan 2011 03:51:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3540</guid>
		<description>Very helpful article! However, I noticed a couple things that might improve it.

1. Your WHILE loop already contains:

	insert into @xp_results
	execute master.dbo.xp_sqlagent_enum_jobs 1, @job_owner, @job_id

	set @running= (SELECT top 1 running from @xp_results)

So, you can simply add &#039;SET @running=0&#039; immediately before entering the WHILE loop and let the loop take care of this &#039;insert exec&#039; and &#039;set&#039; portion.

Otherwise, you are essentially simulating the first &quot;loop&quot; of the WHILE loop outside the loop, and that&#039;s just plain loopy. :D

2. Because you&#039;re now relying on your loop to do what it&#039;s supposed to do, you can remove the first &#039;WAITFOR DELAY&#039; statement and @seccount increment (the one outside the loop), as we&#039;ve got one baked into our loop already.

3. I had to use the following to identify my job in the results of xp_sqlagent_enum_jobs:

		INSERT INTO @Results
		EXECUTE master.dbo.xp_sqlagent_enum_jobs 1, @JobOwnerName		
		SET @IsRunning = (SELECT TOP 1 running FROM @Results WHERE job_id=@JobId)</description>
		<content:encoded><![CDATA[<p>Very helpful article! However, I noticed a couple things that might improve it.</p>
<p>1. Your WHILE loop already contains:</p>
<p>	insert into @xp_results<br />
	execute master.dbo.xp_sqlagent_enum_jobs 1, @job_owner, @job_id</p>
<p>	set @running= (SELECT top 1 running from @xp_results)</p>
<p>So, you can simply add &#8216;SET @running=0&#8242; immediately before entering the WHILE loop and let the loop take care of this &#8216;insert exec&#8217; and &#8217;set&#8217; portion.</p>
<p>Otherwise, you are essentially simulating the first &#8220;loop&#8221; of the WHILE loop outside the loop, and that&#8217;s just plain loopy. <img src='http://blog.boxedbits.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>2. Because you&#8217;re now relying on your loop to do what it&#8217;s supposed to do, you can remove the first &#8216;WAITFOR DELAY&#8217; statement and @seccount increment (the one outside the loop), as we&#8217;ve got one baked into our loop already.</p>
<p>3. I had to use the following to identify my job in the results of xp_sqlagent_enum_jobs:</p>
<p>		INSERT INTO @Results<br />
		EXECUTE master.dbo.xp_sqlagent_enum_jobs 1, @JobOwnerName<br />
		SET @IsRunning = (SELECT TOP 1 running FROM @Results WHERE job_id=@JobId)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Herman</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3510</link>
		<dc:creator>Herman</dc:creator>
		<pubDate>Tue, 07 Dec 2010 16:18:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3510</guid>
		<description>This code rocks !!! Exactly what I needed.  Thanks a lot!</description>
		<content:encoded><![CDATA[<p>This code rocks !!! Exactly what I needed.  Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dmast</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3493</link>
		<dc:creator>dmast</dc:creator>
		<pubDate>Wed, 01 Sep 2010 08:07:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3493</guid>
		<description>Thats&#039; what i needed!
Thank you.</description>
		<content:encoded><![CDATA[<p>Thats&#8217; what i needed!<br />
Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prophix Software</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3490</link>
		<dc:creator>Prophix Software</dc:creator>
		<pubDate>Fri, 16 Jul 2010 18:42:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3490</guid>
		<description>Very helpful article. Thanks much for putting time into this. hope this lands you an awesome job!</description>
		<content:encoded><![CDATA[<p>Very helpful article. Thanks much for putting time into this. hope this lands you an awesome job!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SSIS: Execute Package via Stored Procedure &#124; Ralf Eisenreich</title>
		<link>http://blog.boxedbits.com/archives/124/comment-page-1#comment-3240</link>
		<dc:creator>SSIS: Execute Package via Stored Procedure &#124; Ralf Eisenreich</dc:creator>
		<pubDate>Wed, 30 Sep 2009 14:57:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.boxedbits.com/?p=124#comment-3240</guid>
		<description>[...] [Quelle: http://blog.boxedbits.com/archives/124] [...]</description>
		<content:encoded><![CDATA[<p>[...] [Quelle: <a href="http://blog.boxedbits.com/archives/124" rel="nofollow">http://blog.boxedbits.com/archives/124</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

