Thursday, June 28, 2012

WAIT FOR DELAY

WAITFOR DELAY


SQL Server has an option to wait for delay which means that you can pause your SQL query code (batch) or pause stored procedure for a specified time (<24h) using delay option. There is also an option to specity time (WAITFOR TIME) which you can check in the link at the bottom.


select GETDATE()

waitfor delay '00:00:02';

go

select GETDATE()

waitfor delay '00:00:10';

go

select GETDATE()

Output

(No column name)

2012-06-28 17:06:45.693

(No column name)

2012-06-28 17:06:47.783

(No column name)

2012-06-28 17:06:57.810


No comments:

Post a Comment