It’s late at night, you’re still at work, waiting for long running task to complete so you can go home. Well why not make SQL Server 2005 wait for you?

Well gather your things and make use of the new WAITFOR statement, thats been introduced as part of Service Broker. You can ask SQL Server to wait until a certain time of the day, or until an amount of time passes, or you can wait for a message from a queue.

--Wait until 9:00 PM
WAITFOR TIME '21:00' --Wait for 22 Minutes to pass
WAITFOR DELAY '00:22:00' --Wait for a message to be recieved from a Service Broker messaging queue

Damn nifty! … I’m going home. Till tomorrow!