Retrieving XML Data

The power of SQL Server 2000's XML support lies in its capability to execute SQL queries that return results as XML rather than standard rowsets.

To retrieve results, you use the FOR XML clause of the SELECT statement, and within the FOR XML clause, you specify an XML mode: RAW, AUTO, or EXPLICIT.

The FOR XML RAW returns a <row> tag for each row in the record set. This should be used in a limited fashion because it doesn't effectively use XML's capabilities for describing structured data. FOR XML AUTO names and structures the data by taking hints to how the tables are aliased and joined. FOR XML EXPLICIT allows you to specify the exact structure and naming scheme of the resulting XML. Additionally, the FOR XML EXPLICIT syntax ...

Get Microsoft® SQL Server™ 2000 DBA Survival Guide, Second Edition 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.