Summary

In this chapter we explored FOR XML in detail, and also took a look at mapping schemas. FOR XML allows us to translate a SQL Server result set into XML, giving us a great deal of control over how that XML is formatted. Mapping schemas also provide a mechanism for retrieving SQL Server data in XML format. They provide a greater degree of control than FOR XML, but they're also more complicated to use.

Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The 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.