waitfor

Specifies a specific time, a time interval, or an event for the execution of a statement block, stored procedure, or transaction.

Syntax

waitfor {delay time | time time | errorexit | processexit | mirrorexit} 

Parameters

Examples

Usage

  • After issuing the waitfor command, you cannot use your connection to the SAP ASE server until the time or event that you specified occurs.

  • You can use waitfor errorexit with a procedure that kills the abnormally terminated process, to free system resources that would otherwise be taken up by an infected process.

  • To find out which process terminated, check the sysprocesses table with sp_who.

  • The time you specify with waitfor time or waitfor delay can include hours, minutes, and seconds. Use the format “hh:mi:ss”, as described in Date and Time Datatypes in Reference Manual: Building Blocks.

    The following example instructs the SAP ASE server to wait until 4:23 p.m:
    waitfor time "16:23"
    This statement instructs the SAP ASE server to wait for 1 hour and 30 minutes:
    waitfor delay "01:30"
  • Changes in system time (such as setting the clock back for Daylight Savings Time) can delay the waitfor command.

  • You can use waitfor mirrorexit within a DB-Library program to notify users when there is a mirror failure.

See also:
  • Date and Time Datatypes in Reference Manual: Building Blocks

  • sp_who in Reference Manual: Procedures

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

No permission is required to use waitfor.

Related reference
begin...end