There are situation when you want your piece of code to wait for
some input after it proceed for next group of statement, if the scenario is
like this you can achieve your wait using WAITFOR. So SQL Server has an option
to wait for delay your batch until some short of input arrived.
Post Reference: Vikram Aristocratic Elfin Share
Let’s take a short example to see how we can achieve this.
select GETDATE() as 'First Time'
waitfor delay '00:00:03'
select GETDATE() as '3 Second delay'
waitfor delay '00:00:02'
select GETDATE() as '2 Second delay'
waitfor delay '00:00:01'
select GETDATE() as '1 Second delay'
First Time
-----------------------
2013-10-10
05:24:39.007
(1 row(s)
affected)
3 Second
delay
-----------------------
2013-10-10
05:24:42.007
(1 row(s)
affected)
2 Second
delay
-----------------------
2013-10-10
05:24:44.007
(1 row(s)
affected)
1 Second
delay
-----------------------
2013-10-10
05:24:45.007
(1 row(s) affected)
Here we can see how we are able to achieve the delay of our batch
using WaitFor Delay.
The way SQL
developer says Database is poles apart. You database is safe as tongue in your mouth.
Post Reference: Vikram Aristocratic Elfin Share
No comments:
Post a Comment