Basic Syntax of the FOR XML Clause
The basic syntax for specifying the XML mode in the FOR clause is:
FOR XML mode [, XMLDATA] [, ELEMENTS][, BINARY BASE64]
Arguments
XML mode
Specifies the XML mode. XML mode determines the shape of the resulting XML.
mode can be RAW, AUTO, or EXPLICIT.
XMLDATA
Specifies that an XML-Data schema should be returned. The schema is prepended to the document as an inline schema.
ELEMENTS
If the ELEMENTS option is specified, the columns are returned as subelements. Otherwise, they are mapped to XML attributes. This option is supported in AUTO mode only.
BINARY BASE64
If the BINARY Base64 option is specified, any binary data returned by the query is represented in base64-encoded format. To retrieve binary data using RAW and EXPLICIT mode, this option must be specified. In AUTO mode, binary data is returned as a reference by default.