Need to wait to execute a TSQL in SQL Server?

If you are running tests on a SQL Server database using scripts, usually you may have to create a batch of TSQL and they must be executed in a certain order and in a certain time, to achive this you can use the WAITFOR DELAY statament, it allows your script to wait N seconds before being executed. In the following script we wait 30 seconds before executing the getdate command.

 

WAITFOR DELAY '00:00:30' ---- 30 Seconds Delay
SELECT GETDATE() CurrentTime

 

Regards,

 

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

http://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/




Comments

Popular posts from this blog

Cómo identificar consultas más pesadas en SQL Server

Permitiendo la administración de los jobs a usuarios que no son System Administrators en SQL Server Agent 2005 o superior

FileTable en SQL Server 2012