SLEEP (TSQL Statement)
sleeps for the specified number of seconds.
Syntax
SLEEP seconds
Arguments
- seconds
- is the number of seconds to sleep. It can be a fractional number, e.g. 10.5 for 10 seconds and a half.
- The max value for seconds is 600 (10 minutes).
Remarks
This statement doesn’t exist in MS SQL Server, which implements the equivalent
WAITFOR DELAY
.
The statement SLEEP
is essentially used for learning purpose. As all locks are retained until the script terminates, we can study them and investigate their effects.
Examples
SLEEP 10; -- sleeps for 10 seconds
SLEEP 10.5; -- sleeps for 10.5 seconds