Posts

Showing posts with the label delaying

SQL SERVER Delaying Sql Execution Use of WAITFOR Cluse

SQL SERVER Delaying Sql Execution Use of WAITFOR Cluse --Example:-1 --WHILE LOOP --USE WAITFOR FOR DELAYING THE EXECUTION FOR SPECIFIED TIME GO DECLARE @T INT SET @T=1 WAITFOR DELAY 00:00:10 WHILE @T<=10 BEGIN PRINT MANOJ_KUMAR SET @T = @T+1 END GO --Example:-2 GO WAITFOR DELAY 00:00:02 SELECT THIS IS DB BLOG GO Descriptions:- It block/slow down the execution Process of any sql statement(Procedure/Commands).The delay specified period of time that must pass, up to a maximum of 24 hours, before execution of a batch, stored procedure, or transaction proceeds. While executing the WAITFOR statement, the transaction is running and no other requests can run under the same transaction. The actual time delay may vary from the time to time specified and depends on the activity level of the server. The time counter starts when the thread associated with the WAITFOR statement is scheduled. If the server is busy, the thread may not be immediately scheduled; therefore, the time delay may...