WAITFOR
WAITFOR is a SQL Server command used to add a delay or to set a specific time when the subsequent queries or statements should be executed. It can be configured for a specified amount of time or until a specific time of the day. There are two types of WAITFOR command: WAITFOR DELAY and WAITFOR TIME.
Example
Output
Explanation
The WAITFOR
statement in SQL Server is used to delay the execution of commands. In the above example, the system gets the current timestamp, waits for 2 seconds, then gets and prints the new timestamp which is 2 seconds later than the first one.