RAW
Mode
When specified at the end of a SELECT
statement, the keywords FOR XML RAW
tell SQL Server to generate a one-XML-element-per-row structure. The FOR XML
statement has a few options that change its output from the default of document fragments to well-formed documents with a slightly (compared to a few other FOR XML
options) reshaped structure. This is its syntax:
Listing 47.1 illustrates the XML generated by the no-option version of FOR XML RAW
. (Note that all the code in this chapter relies on the AdventureWorks2008
sample database.)
This kind of XML shape ...
Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.