SQL SERVER – Delay Command in SQL Server – SQL in Sixty Seconds #055

Have you ever needed WAIT or DELAY function in SQL Server?  Well, I personally have never needed it but I see lots of people asking for the same. It seems the need of the function is when developers are working with asynchronous applications or programs. When they are working with an application where user have to wait for a while for another application to complete the processing. SQL Server has a delay command for exactly this, WAITFOR DELAY.

SQL SERVER - Delay Command in SQL Server - SQL in Sixty Seconds #055

If you are programming language developer, it is very easy for you to make the application wait for command however, in SQL I personally have rarely used this feature.  However, I have seen lots of developers asking for this feature in SQL Server, hence I have decided to build this quick video on the same subject.

We can use WAITFOR DELAY ‘timepart’ to create a SQL Statement to wait.

Let us see the same concept in following SQL in Sixty Seconds Video:

Related Tips in SQL in Sixty Seconds:

What would you like to see in the next SQL in Sixty Seconds video?

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

Database, SQL Identity, SQL in Sixty Seconds, SQL Scripts
Previous Post
SQL SERVER – Need Your Feedback – Next Action Items in SQL in Sixty Seconds
Next Post
SQL SERVER – Reset SA Password – SQL in Sixty Seconds #066

Related Posts

3 Comments. Leave new

  • hmm.. making videos of all your previous blogs.. nice

    Reply
  • Another need happens quite often when you would like to simulate traffic / complex queries in your solution to find out “hot spots” with large number of db calls (for example when using ORM since it is not clearly visible how many queries are fired ). With the delay you can easily see where program explodes and keep on profiling detailed parts of code.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.