Appendix D. XQuery/XPath/XML DML Quick Reference

This chapter serves as a quick reference to XQuery, XPath, and XML DML functionality as implemented in SQL Server 2008.

XPath

The FOR XML PATH provides support for naming result columns using a subset of XPath-style paths, including node tests. Path expressions in XPath consist of location steps separated by forward slash (/) characters. Each step of the path represents an element or attribute in a hierarchical XML structure. Listing D-1 shows sample FOR XML PATH XPath-style paths.

Example D-1. Sample Path Expressions in FOR XML PATH

@customer-number
shipping-address/city
address/billing-address/@postal-code

Path expressions used with FOR XML PATH must follow certain rules, including the following:

Get Pro SQL Server 2008 XML 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.