SQL Flow Field Guide

:XML

Check your sqlcmd client variant and platform

Switch the client's XML output mode.

Syntax at a glance

:XML [ ON | OFF ]

Work example

Review a Windows XML export

In a Windows lab that supports this mode, enable :XML ON around a FOR XML SELECT. Restore :XML OFF before returning to regular result sets.

Check your work The export contains the expected XML and normal tabular output resumes afterward.

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