SQL Flow Field Guide

CREATE QUEUE

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

defines queue (no row flow)

What changes

Input
catalog
Output or change
catalog: queue

Syntax at a glance

CREATE QUEUE <object> [ WITH [ STATUS = { ON | OFF } [ , ] ] [ RETENTION = { ON | OFF } [ , ] ] [ ACTIVATION ( [ STATUS = { ON | OFF } , ] PROCEDURE_NAME = <procedure> , MAX_QUEUE_READERS = max_readers , EXECUTE AS { SELF | 'user_name' | OWNER } ) [ , ] ] [ POISON_MESSAGE_HANDLING ( [ STATUS = { ON | OFF } ] ) ] ] [ ON { filegroup | [ DEFAULT ] } ] [ ; ]

Work example

A Service Broker service needs a queue with defined activation and retention behavior.

Review message retention, poison-message handling, activation procedure, reader count, and execution context.

Check your work A lab message is consumed once and a failed handler does not create an unbounded retry loop.

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