WAITFOR
Example
Section titled “Example”BEGINPRINT GETDATE();WAITFOR DELAY '00:00:02';PRINT GETDATE();ENDOutput
Section titled “Output”Oct 11 2021 12:00:00Oct 11 2021 12:00:02Explanation
Section titled “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.