RAW Mode

RAW mode is the simplest of the three basic FOR XML modes. It performs a very basic translation of the result set into XML. Here's an example:

SELECT CustomerId, CompanyName
FROM Customers FOR XML RAW

(Results abridged)

 XML_F52E2B61-18A1-11d1-B105-00805F49916B --------------------------------------------------------------------------- <row CustomerId="ALFKI" CompanyName="Alfreds Futterkiste"/><row CustomerId="ANATR" CompanyName="Ana Trujillo Emparedados y helados"/><row CustomerId="ANTON" CompanyName="Antonio Moreno Taquer?a"/><row CustomerId="AROUT" CompanyName="Around the Horn"/><row CustomerId="BERGS" CompanyName="Berglunds snabbk?p"/><row CustomerId="BLAUS" CompanyName="Blauer See Delikatessen"/><row CustomerId="BLONP" CompanyName="Blondesddsl ...

Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The 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.