SQL Flow Field Guide

WAITFOR

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

blocks execution

What changes

Input
delay, time, or a RECEIVE/GET CONVERSATION GROUP statement
Output or change
none

Syntax at a glance

WAITFOR { DELAY 'time_to_pass' | TIME 'time_to_execute' | [ ( receive_statement ) | ( get_conversation_group_statement ) ] [ , TIMEOUT timeout ] }

Work example

A lab must demonstrate a delay or wait for a message with a known timeout.

Use a short bounded delay only in an isolated session. Never put an unbounded wait in a request path.

Check your work WAITFOR. The wait ends within its stated limit and does not hold an open transaction or lock.

Open Microsoft Learn for full syntax, permissions, and details for your version.