SQL Server/T-SQL Tutorial/Transact SQL/WAITFOR

Материал из SQL эксперт
Перейти к: навигация, поиск

The TIME Parameter

   <source lang="sql">

WAITFOR TIME "01:00"

  GO</source>
   
  

The WAITFOR Statement

   <source lang="sql">

WAITFOR DELAY "01:00"

  GO</source>
   
  

Using WAITFOR

   <source lang="sql">

The WAITFOR command delays the execution of Transact-SQL code for a specified length of time. The syntax for WAITFOR is as follows: WAITFOR {

   DELAY "time_to_pass"
 | TIME "time_to_execute"
 | ( receive_statement ) [ , TIMEOUT timeout ]

}</source>


WAITFOR DELAY "00:00:01"

   <source lang="sql">

2> CREATE TABLE T ( 3> int1 int, 4> bit1 bit NOT NULL DEFAULT 0, 5> rvr1 timestamp, 6> usr1 nvarchar(128) DEFAULT USER, 7> createtime datetime DEFAULT CURRENT_TIMESTAMP 8> ) 9> GO 1> 2> INSERT T (int1, bit1) VALUES (2, 0) 3> WAITFOR DELAY "00:00:01" 4> GO 1> 2> drop table t; 3> GO</source>