O'Reilly logo

Microsoft® SQL Server™ 2000 DBA Survival Guide, Second Edition by Mark Spenik, Orryn Sledge

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required