Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

WAITFOR Expand / Collapse
Author
Message
Posted Monday, June 16, 2008 8:53 PM
SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,039, Visits: 1
Comments posted to this topic are about the item WAITFOR
Post #517982
Posted Tuesday, June 17, 2008 5:19 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 11:32 AM
Points: 2,669, Visits: 779
WAITFOR
{
DELAY 'time_to_pass'
| TIME 'time_to_execute'
| [ ( receive_statement ) | ( get_conversation_group_statement ) ]
[ , TIMEOUT timeout ]
}


I wondered when I answered the question about the service broker but it wasn't mentioned in the BOL so I figured I was okay.

http://msdn.microsoft.com/en-us/library/ms187331.aspx?n=0


Jamie
Post #518117
Posted Tuesday, June 17, 2008 7:21 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 7:27 AM
Points: 1,186, Visits: 1,973
I somewhat disagree that a TIMEOUT can be used to end a WAITFOR. It cannot be used independently and is only an optional modifier of the Service Broker message.


(PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.
Post #518221
Posted Tuesday, June 17, 2008 8:52 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, December 26, 2011 2:08 PM
Points: 196, Visits: 54
receive_statement

Is a valid RECEIVE statement.
Important:
WAITFOR with a receive_statement is applicable only to Service Broker messages. For more information, see RECEIVE (Transact-SQL).


:D
Post #518330
Posted Tuesday, June 17, 2008 9:33 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, August 31, 2014 6:28 AM
Points: 1,426, Visits: 342
I think so.
Timeout option is not directly related with WAITFOR TSQL is an optional part.
Post #518379
Posted Tuesday, June 17, 2008 10:22 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, August 31, 2014 6:28 AM
Points: 1,426, Visits: 342
I agree.
Timeout is an optional syntax of WAITFOR TSQL command
Post #518414
Posted Tuesday, June 17, 2008 2:06 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, August 28, 2014 8:53 PM
Points: 1,388, Visits: 3,039
This is a good QOD in that it prompted a careful reading of the syntax of an unfamiliar (to me, anyway) feature. The keywords "DELAY", "TIME", and "TIMEOUT" all sound so much like the same sort of thing that I had to read the definition of those terms two or three times. Let's see if I've got them straight now:

-- DELAY lets you specify an interval to wait after the WAITFOR statement is encountered before the rest of the SQL is executed.
-- TIME is an alternative to DELAY in that it lets you specify a specific time of day at which you want your SQL to continue to execute.
-- TIMEOUT gives you a safety net if you're waiting for a Service Broker message. Execution proceeds if the message hasn't arrived within the time you're willing to wait for it.

So, yes, all four options are correct answers as to what will terminate a WAITFOR, allowing the rest of the SQL to continue.
Post #518561
Posted Wednesday, June 18, 2008 6:21 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 3:19 AM
Points: 5,371, Visits: 1,391
Nice question.............:)


Post #518923
Posted Thursday, June 19, 2008 12:52 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, September 17, 2014 1:05 AM
Points: 2,842, Visits: 3,875
I also missed that one because of the TIMEOUT. But re-reading the question revealed that the question writer had this in mind when choosing his wording.
Tricky


Best Regards,
Chris Büttner
Post #519623
Posted Thursday, December 23, 2010 4:00 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:18 PM
Points: 7,687, Visits: 9,407
Mauve (6/17/2008)
I somewhat disagree that a TIMEOUT can be used to end a WAITFOR. It cannot be used independently and is only an optional modifier of the Service Broker message.

I agree with Mauve, you can wait for a message or you can wait for whichever comes first, a message of a timeout, but you can't wait for just a timeout.


Tom
Post #1038968
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse