SQL Server

SQL Server: WAITFOR Statement

WAITFOR statement used to delay execution of T-SQL command for a specified period of time. This can be used to block the execution of batch statement, stored procedure and T SQL commands for a specified time.

There are two parameters can be used with WAITFOR statement.

clip_image001

Let us create simple stored procedure

clip_image002

Let us execute above stored procedure after delay of 1 minute

clip_image003

In above query we are using delay with WAITFOR.

clip_image004

Above query will execute stored procedure at 10.06PM. Time we will need to provide on scale of 24 hrs. For 1 Pm we need to give input as 13.00.

About Dhananjay Kumar

Dhananjay Kumar is Developer, Blogger , Speaker, Learner , Mindcracker & Microsoft MVP.

Discussion

Trackbacks/Pingbacks

  1. Pingback: Monthly Report March 2011: Total Posts 15 « debug mode…… - December 4, 2011

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,380 other followers

Tweets

Categories

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my current or previous employer's view in anyway. © Copyright 2012