Flattening hierarchical XML in SQL using the nodes() method
问题 I have a Stored Procedure that takes an XML document as a parameter similar in a structure to the following: <grandparent name="grandpa bob"> <parent name="papa john"> <children> <child name="mark" /> <child name="cindy" /> </children> </parent> <parent name="papa henry"> <children> <child name="mary" /> </children> </parent> </grandparent> My requirement is to "flatten" this data so that it can be inserted into a temporary table and manipulated further down the procedure, so the above XML