SQL Flow Field Guide

CREATE CONTRACT

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

defines contract (no row flow)

What changes

Input
catalog
Output or change
catalog: contract

Syntax at a glance

CREATE CONTRACT contract_name [ AUTHORIZATION owner_name ] ( { { message_type_name | [ DEFAULT ] } SENT BY { INITIATOR | TARGET | ANY } } [ ,...n] ) [ ; ]

Work example

Two Service Broker services need an explicit list of message types they may exchange.

List each message type and direction, then compare that contract with both service handlers.

Check your work Every expected message is permitted and no unplanned message type appears in the contract.

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