| title | Server-side XML Formatting (SQLXML 4.0) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql-server-2016 | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | reference | ||
| helpviewer_keywords |
|
||
| ms.assetid | ae9ea068-0857-4505-a3b2-f53d256b644c | ||
| caps.latest.revision | 12 | ||
| author | douglaslMS | ||
| ms.author | douglasl | ||
| manager | jhubbard |
This topic provides information about formatting XML documents on the server side from the rowsets that are generated by queries executed against a database in Microsoft [!INCLUDEssNoVersion].
In [!INCLUDEssNoVersion], you can store and retrieve XML documents to and from database tables. To retrieve an XML document, use the FOR XML query extension in a SELECT query.
For example, assume a client application executes a command against [!INCLUDEssNoVersion] that consists of the following [!INCLUDEtsql] query:
SELECT FirstName, LastName
FROM Person.Contact
FOR XML AUTO
The server executes the query in two steps. First, the server executes this SELECT statement:
SELECT FirstName, LastName
FROM Person.Contact
Then the server applies the FOR XML transformation to the generated rowset. The resulting XML is then sent to the client as a one-column rowset. In this documentation, this process is referred to as server-side XML formatting.
On the server side, you can specify the following modes with a FOR XML clause:
-
RAW
-
AUTO
-
EXPLICIT
For more information about the FOR XML clause, see Constructing XML Using FOR XML.
Architecture of Client-side and Server-side XML Formatting (SQLXML 4.0)
Client-side XML Formatting (SQLXML 4.0)
FOR XML (SQL Server)