©  Alex Grinberg 2018
Alex GrinbergXML and JSON Recipes for SQL Serverhttps://doi.org/10.1007/978-1-4842-3117-3_4

4. Shredding XML

Alex Grinberg1 
(1)
Richboro, Pennsylvania, USA
 

Converting XML data into relational columns and rows is not an easy process. The OPEXML function was introduced to shred XML data in SQL Server 2000, and then XML shredding was improved by the XPath language (also known as XQuery) in SQL Server 2005. Since then, the process of querying XML data became a solid solution to deliver results. This chapter will demonstrate how to query XML data as a single unit and return the retrieved data across a table’s column.

4-1. Shredding XML with Internal ENTITY Declarations

Problem

You want to return a rowset result out of the XML data ...

Get XML and JSON Recipes for SQL Server: A Problem-Solution Approach 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.