SQL Server: WAITFOR Statement
WAITFOR statement used to delay execution of T-SQL command for a specified period of time. This can be used to block the execution of batch statement, stored procedure and T SQL commands for a specified time.
The WAITFOR statement is used to delay execution of the T-SQL command for a specified period of time. This can be used to block the execution of a batch statement, a stored procedure or a T SQL command for a specified time.
There are two parameters that can be used with the WAITFOR statement.
Let us create a simple stored procedure.
Let us execute the preceding stored procedure after a delay of 1 minute.
In the preceding query we are using a delay with WAITFOR.
The preceding query will execute the stored procedure at 10.06PM. The time must be expressed using a 24 hours value. For 1 PM we need to give input as 13:00.