If you want your part of code to execute after a particular time
then you can achieve this with the help of SQL Server WAITFOR TIME clause here
you have mention the time along with the WAITFOR.
Let’s take a short example to see how we can achieve this. THRIST
select GETDATE() as 'Time'
WAITFOR TIME '05:40:00'
select GETDATE() as 'Delayed Time'
SELECT 'Hi its Morning'
Time
-----------------------
2013-10-10
05:39:56.440
(1 row(s)
affected)
Delayed Time
-----------------------
2013-10-10
05:40:00.000
(1 row(s) affected)
Hi its Morning
Here we can see how we are able to achieve the delay of our batch
using WaitFor Time.
Never miss
a good chance to do good piece code.
Post Reference: Vikram Aristocratic Elfin Share
No comments:
Post a Comment