Introduction:
In this article,i am going to explain about how to use WAITFOR in sql server 2008.
Main:
In SQL Server 2000, WAITFOR waited for a specified duration or a supplied datetime value. Starting with SQL Server 2005, as with the TOP enhancements, you can use WAITFOR with a SQL expression. You can essentially use the WAITFOR function to wait for a T-SQL statement to affect at least one row. (You can also set a time-out on that SQL expression.) You can specify WAITFOR to wait not only in SELECT statements but also in INSERT, UPDATE, DELETE, and RECEIVE statements. In essence, SELECT statements won’t complete until at least one row is produced, and data manipulation language (DML) statements won’t complete until at least one row is affected.
Here is the syntax:
WAITFOR(
This feature provides an alternative to polling. For example, you can use WAITFOR to select all the records in a log or a queue table, as shown here:
WAITFOR (SELECT * FROM MyQueue)
WAITFOR (SELECT * FROM MyQueue) |
Conclusion:
Hope this helps,
Happy Coding.
This site is a walk-through for all the information you wanted about this and didn’t know who to ask. Look here, and you’ll definitely find it.
Usually I do not post on blogs, but I would like to say that this article really forced me to do so! Thanks, really nice article.