O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

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 from SQL Server 2000 via SELECT...FOR XML

After covering the XML features included with SQL Server 2005, discussing SELECT ... FOR XML queries is somewhat anticlimactic. I’ve included the information here for developers who are still using SQL Server 2000 in their applications and therefore can’t use SQL Server 2005’s XML features.

Executing a SELECT ... FOR XML Query in SQL Server Query Analyzer

The simplest way to execute such a query and examine the results is to execute the query in SQL Server Query Analyzer. Let’s take a simple query that retrieves the values of the CustomerID and CompanyName columns for the first two rows in the Customers table:

SELECT TOP 2 CustomerID, CompanyName FROM Customers

And then let’s append the ...

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