<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Delay Function &#8211; WAITFOR clause &#8211; Delay Execution of Commands</title>
	<atom:link href="http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 10 Feb 2012 04:35:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: anuradha</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-130410</link>
		<dc:creator><![CDATA[anuradha]]></dc:creator>
		<pubDate>Thu, 21 Apr 2011 20:05:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-130410</guid>
		<description><![CDATA[Hi,

I am kind-of new to SQL server and having trouble with a stored procedure with a query timeout set to 9secs.

when i use the following sp,
CREATE PROCEDURE Sleepy @sleep INT AS 
BEGIN 
        DECLARE @now DATETIME; 
        DECLARE @end DATETIME; 
        SET @now = SYSDATETIME(); 
        SET @end = DATEADD(S, @sleep, @now); 
        WHILE (@now &lt; @end) 
                SET @now = SYSDATETIME(); 
END; 

i do not see a timeout , even tho&#039; the sleepy is passed 10 secs.the sp completed execution wwithout interruption

However when i use &quot;WAITFOR DELAY&quot; in sp....
in 9 secs i get a timeout.

It is not clear , why in the first case, i am not receiving a timeout whereas the second case throws a query timeout exception as expected.

Please clarify]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am kind-of new to SQL server and having trouble with a stored procedure with a query timeout set to 9secs.</p>
<p>when i use the following sp,<br />
CREATE PROCEDURE Sleepy @sleep INT AS<br />
BEGIN<br />
        DECLARE @now DATETIME;<br />
        DECLARE @end DATETIME;<br />
        SET @now = SYSDATETIME();<br />
        SET @end = DATEADD(S, @sleep, @now);<br />
        WHILE (@now &lt; @end)<br />
                SET @now = SYSDATETIME();<br />
END; </p>
<p>i do not see a timeout , even tho&#039; the sleepy is passed 10 secs.the sp completed execution wwithout interruption</p>
<p>However when i use &quot;WAITFOR DELAY&quot; in sp&#8230;.<br />
in 9 secs i get a timeout.</p>
<p>It is not clear , why in the first case, i am not receiving a timeout whereas the second case throws a query timeout exception as expected.</p>
<p>Please clarify</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ritish</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-107481</link>
		<dc:creator><![CDATA[Ritish]]></dc:creator>
		<pubDate>Thu, 23 Dec 2010 09:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-107481</guid>
		<description><![CDATA[Hi,
I read your blogs and find very usefull in solving the problrms releated to sql queries. My problem is that I have a stored procedure and when I execute it first time it take a lot of time vene up to 5-10 minutes.But second time it execute within 1 minutes. But if I execute some other query after its excution or execute the procedures after an interval it again take a long time to execute. Can u please suggest what I have to do to stop this long interval during execution?]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
I read your blogs and find very usefull in solving the problrms releated to sql queries. My problem is that I have a stored procedure and when I execute it first time it take a lot of time vene up to 5-10 minutes.But second time it execute within 1 minutes. But if I execute some other query after its excution or execute the procedures after an interval it again take a long time to execute. Can u please suggest what I have to do to stop this long interval during execution?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andik Laksono</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-57858</link>
		<dc:creator><![CDATA[Andik Laksono]]></dc:creator>
		<pubDate>Tue, 24 Nov 2009 12:41:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-57858</guid>
		<description><![CDATA[Wow , it&#039;s work Man !!!

thanks a lot]]></description>
		<content:encoded><![CDATA[<p>Wow , it&#8217;s work Man !!!</p>
<p>thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anas</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-55808</link>
		<dc:creator><![CDATA[Anas]]></dc:creator>
		<pubDate>Fri, 11 Sep 2009 07:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-55808</guid>
		<description><![CDATA[Thanks for the enlightenment, it&#039;s fix my problem...]]></description>
		<content:encoded><![CDATA[<p>Thanks for the enlightenment, it&#8217;s fix my problem&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dharmender Kumar</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-51562</link>
		<dc:creator><![CDATA[Dharmender Kumar]]></dc:creator>
		<pubDate>Tue, 05 May 2009 13:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-51562</guid>
		<description><![CDATA[Thanks to give this solution. Thankyou so much!!]]></description>
		<content:encoded><![CDATA[<p>Thanks to give this solution. Thankyou so much!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rama</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-46649</link>
		<dc:creator><![CDATA[Rama]]></dc:creator>
		<pubDate>Sat, 14 Feb 2009 00:20:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-46649</guid>
		<description><![CDATA[Thanks for the code]]></description>
		<content:encoded><![CDATA[<p>Thanks for the code</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim M.</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-34731</link>
		<dc:creator><![CDATA[Tim M.]]></dc:creator>
		<pubDate>Mon, 31 Mar 2008 15:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-34731</guid>
		<description><![CDATA[First, I want to thank you for your blog, I inadvertently read it more than I think I would, it has been a great help. 

Question for you though; I have a cursor which performs a number of actions on databases (CBCC CheckDB &amp; Shrinkdatabase) as well as backs them up and zips them. 

How would I best use a waitfor command (SQL 2000) to make sure the steps aren&#039;t overlapping or leapfrogging the other? A time based variable may just cause more problems as far as I can see (may be too long or too short), so is this possible or am I barking up the wrong tree?

Thanks

Tim M]]></description>
		<content:encoded><![CDATA[<p>First, I want to thank you for your blog, I inadvertently read it more than I think I would, it has been a great help. </p>
<p>Question for you though; I have a cursor which performs a number of actions on databases (CBCC CheckDB &amp; Shrinkdatabase) as well as backs them up and zips them. </p>
<p>How would I best use a waitfor command (SQL 2000) to make sure the steps aren&#8217;t overlapping or leapfrogging the other? A time based variable may just cause more problems as far as I can see (may be too long or too short), so is this possible or am I barking up the wrong tree?</p>
<p>Thanks</p>
<p>Tim M</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MoSaB</title>
		<link>http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-30821</link>
		<dc:creator><![CDATA[MoSaB]]></dc:creator>
		<pubDate>Wed, 02 Jan 2008 07:07:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/18/sql-server-delay-function-waitfor-clause-delay-execution-of-commands/#comment-30821</guid>
		<description><![CDATA[verry interesting, 

but as I know that this &#039;waitfor delay&#039; will only block for the current session, so the sql server will process other requests for other sessions even if the delay interval doesn&#039;t finish yet.

can you verify that, please ?
Thanks,
Mosab]]></description>
		<content:encoded><![CDATA[<p>verry interesting, </p>
<p>but as I know that this &#8216;waitfor delay&#8217; will only block for the current session, so the sql server will process other requests for other sessions even if the delay interval doesn&#8217;t finish yet.</p>
<p>can you verify that, please ?<br />
Thanks,<br />
Mosab</p>
]]></content:encoded>
	</item>
</channel>
</rss>

