About Me

My photo
Mumbai, Maharastra, India
He has more than 7.6 years of experience in the software development. He has spent most of the times in web/desktop application development. He has sound knowledge in various database concepts. You can reach him at viki.keshari@gmail.com https://www.linkedin.com/in/vikrammahapatra/ https://twitter.com/VikramMahapatra http://www.facebook.com/viki.keshari

Search This Blog

Monday, October 14, 2013

Pause your execution of block till a particular time using WAITFOR TIME


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