Example 3: Calling a Web Method–Bound Stored Procedure That Returns XML

For your third and final web method, you create a stored procedure that returns XML from an xml column, using the new FOR XML PATH syntax. To do this, you need to create the stored procedure in Listing 48.9 in the context of the AdventureWorks2008 database.

Listing 48.9 A Stored Procedure That Returns XML

image

The Resume column of HumanResources.JobCandidate is of the new SQL data type xml. The .query() syntax used in GetJobCandidateResumeXml is part of the XQuery language, which is newly supported in SQL Server 2008. Chapter 47, “Using XML in SQL Server 2008,” describes these ...

Get Microsoft® SQL Server 2008 R2 Unleashed 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.