WAITFOR used to pauses the execution of query from certain time.
There are two type's of Wait for.
- WAITFOR DELAY
- WAITFOR TIME
1. WAITFOR DELAY
WAITFOR DELAY Cause the execution to delay from specified duration. For example it pause's the execution for 5 second's.
Example
- WAITFOR DELAY '00:00:05'
- SELECT * FROM EMP
2. WAITFOR TIME
WAITFOR TIME is pause's the execution wait for specified time. For example '13:15:00' whenever time reached the query will be executed.
- WAITFOR TIME '13:15:00'
- SELECT * FROM EMP
- SELECT GETDATE()