Shredding XML using OPENXML: Convert XML to Rowset part II
In this previous blog post, we learned how to use the OPENXML function to covert XML nodes to a single column in tabular format. Today, we'll learn how to convert all the nodes in a XML document to tabular format. We'll use the same XML document on technet with some modifications for the examples below. -- prepare XML document DECLARE @XmlDoc XML = N'<bookstore specialty="novel"> <book style="autobiography"> <title>Create a Vision</title> <author> <first-name>Joe</first-name> <last-name>Smith</last-name> </author> <price>12</price> </book> <book style="textbook"> <title>XML Reference</title> <author first-name="Mary" last-name="Jane" /> <price>55</price> </book> <book style="novel" id="myfave"> <title>Paths to Success...