Category: SQL Server
view more software Tips and Tricks
Updated: 10/14/2011 09:10 AM
Author: Shiju Mathews
Blocks the execution of a batch, stored procedure, or transaction until a specified time or time interval is reached, or a specified statement modifies or returns at least one row.
While executing the WAITFOR statement, the transaction is running and no other requests can run under the same transaction. If the server is busy, the thread may not be immediately scheduled; therefore, the time delay may be longer than the specified time. WAITFOR can be used with query but not with UDF or cursors. WAITFOR wait till TIMEOUT is reached.
WAITFOR DELAY 'Delay_Time'
Where Delay_Time is the time dealy before the execution of the next statement.