Retrieving Data in XML Format

SQL Server 2000 provides several ways to retrieve data in XML format from SQL Server. You can retrieve XML data through normal database connections or across a HyperText Transfer Protocol (HTTP) connection, such as an intranet or even the Internet. When connecting over HTTP, you can even use XML to communicate with the database server, in addition to getting results formatted in XML. First, I want to show you how to retrieve data formatted in XML, regardless of how you're connecting to your database or the format of your queries.

FOR XML

SQL Server 2000 adds to the SELECT statement a new clause, called the FOR XML clause, which instructs SQL Server to return the result of a query in XML format. You even have control ...

Get XML and SQL: Developing Web Applications 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.