SQL Server/T-SQL Tutorial/Transact SQL/WAITFOR
The TIME Parameter
WAITFOR TIME "01:00"
GO
The WAITFOR Statement
WAITFOR DELAY "01:00"
GO
Using WAITFOR
The WAITFOR command delays the execution of Transact-SQL code for a specified length of time.
The syntax for WAITFOR is as follows:
WAITFOR
{
DELAY "time_to_pass"
| TIME "time_to_execute"
| ( receive_statement ) [ , TIMEOUT timeout ]
}
WAITFOR DELAY "00:00:01"
2> CREATE TABLE T (
3> int1 int,
4> bit1 bit NOT NULL DEFAULT 0,
5> rvr1 timestamp,
6> usr1 nvarchar(128) DEFAULT USER,
7> createtime datetime DEFAULT CURRENT_TIMESTAMP
8> )
9> GO
1>
2> INSERT T (int1, bit1) VALUES (2, 0)
3> WAITFOR DELAY "00:00:01"
4> GO
1>
2> drop table t;
3> GO