Skip to content

WAITFOR

BEGIN
PRINT GETDATE();
WAITFOR DELAY '00:00:02';
PRINT GETDATE();
END
Oct 11 2021 12:00:00
Oct 11 2021 12:00:02

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.