SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


WAITFOR


WAITFOR

Author
Message
Site Owners
Site Owners
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: Administrators
Points: 18633 Visits: 222
Comments posted to this topic are about the item WAITFOR
Jamie-2229
Jamie-2229
SSCertifiable
SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)

Group: General Forum Members
Points: 5575 Visits: 862
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
Mauve
Mauve
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

Group: General Forum Members
Points: 6790 Visits: 2071
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.
chajere
chajere
SSC Veteran
SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)

Group: General Forum Members
Points: 242 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).


BigGrin
Ric Sierra
Ric Sierra
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1855 Visits: 342
I think so.
Timeout option is not directly related with WAITFOR TSQL is an optional part.
Ric Sierra
Ric Sierra
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1855 Visits: 342
I agree.
Timeout is an optional syntax of WAITFOR TSQL command
john.arnott
john.arnott
SSCertifiable
SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)

Group: General Forum Members
Points: 7100 Visits: 3059
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.
Anipaul
Anipaul
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14631 Visits: 1407
Nice question.............Smile



Christian Buettner-167247
Christian Buettner-167247
SSCrazy Eights
SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)SSCrazy Eights (8.5K reputation)

Group: General Forum Members
Points: 8543 Visits: 3889
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
Tom Thomson
Tom Thomson
SSC Guru
SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)SSC Guru (50K reputation)

Group: General Forum Members
Points: 50906 Visits: 13159
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

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search