SQL Flow Field Guide

XML (overview)

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

xml data type (typed by an XML schema collection or untyped)

What changes

Input
none
Output or change
none

Syntax at a glance

xml [ ( [ CONTENT | DOCUMENT ] xml_schema_collection ) ]

Work example

Keep a structured document in one column when the source and query contract are genuinely XML-shaped.

Choose typed XML with a schema collection when the document must follow a stable contract.

Check your work XML well-formedness does not prove that required business elements or values are present.

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