Dealy in sql or Wait in sql query

In many application or process we required dealy

there is dealy in sql server
call WAITFOR

select '1'
WAITFOR DELAY '00:00:30'

above query run and wait 30 sec for output

select '2'
WAITFOR Time '15:00'

above query run and wait for 3:00pm for output.

WAITFOR gives out put after end of process, if you want out put after each wait then use code as follows

select getdate()
WAITFOR DELAY '00:00:30'
Go
select getdate()
WAITFOR DELAY '00:00:30'
Go
select getdate()
Go

alternate logic for delay is while loop but its not accurate
it gives different interval on different configuration server.

Leave a Reply

I'm Yogesh Kadvekar, a Technology Consultant, Computer Engineer by education, tech writer and problem solver. I love startups. I love hiking, sports, arts and Stock market. Say hello!

%d bloggers like this: