on 2010 Mar 25 9:46 AM
I must confess, I have often wanted to use WAITFOR TIME because that's what I have: a desired point in time that I want the code to wait for.
However, I have always ended up using WAITFOR DELAY even if it means doing extra work; e.g., a DATEDIFF calculation.
My concern is this line from the Help: If the current server time is greater than the time specified, processing is suspended until that time on the following day.
Consider the following pseudo-code:
SET @t = obtain or calculate a desired "wait for" time that is 0.01 seconds in the future; Perform some operation that might take more than 0.01 seconds to perform; WAITFOR TIME @t;
Most of the time, WAITFOR will wait for less than 1/10th of a second. Sometimes, however, CURRENT TIME may be > @t, which means the WAITFOR waits for about 24 hours.
Egad! Zounds! That's not what I want!
What I think I want is WAITFOR TIMESTAMP. Until then, I'll stick to WAITFOR DELAY.
I would vote also for an enhanced behaviour. WAITFOR TIME is only usefull if you build something like a scheduler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kind of funny, Breck's question has WAITed FOR a long TIME to get an answer:)
I used the Command the first time and the documentation is really strange. Wine also gets better when you let it breath.
User | Count |
---|---|
62 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.