Condividi tramite


Server-side XML Formatting (SQLXML 4.0)

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 SQL Server 2005.

In SQL Server 2005, 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 SQL Server 2005 that consists of the following Transact-SQL 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.

Vedere anche

Riferimento

Architecture of Client-side and Server-side XML Formatting (SQLXML 4.0)
Client-side XML Formatting (SQLXML 4.0)

Altre risorse

Costruzione di codice XML tramite la clausola FOR XML

Guida in linea e informazioni

Assistenza su SQL Server 2005