SelectStarFrom
SelectStarFrom

Reputation: 171

How to shred Column names as well as data from the XML

I have a XML which has a header group with column names and a data group with the actual data belonging to those columns.

Sample XML:

<headerGroup> 
   <data> 
      <string>Column 1</string> 
   </data> 
   <data> 
      <string>Column 2</string> 
   </data> 
</headerGroup> 
<dataGroup> 
   <data> 
      <string> abcd </string> 
   </data> 
   <data> 
      <double> 1234</double> 
   </data> 
</dataGroup> 
<dataGroup> 
   <data> 
      <string> xyz</string> 
   </data> 
   <data> 
       <double> 78945</double> 
   </data> 
</dataGroup> 

I need to shred this xml into a table with those column names and corresponding data. Expected output:

Column 1      Column 2
------------- ------------------- 
abcd           1234 
xyz           78945

The column names and data do not share the same tags so there is no way to relate them to each other.

keep in mind the column names are variable and can change.

thanks in advance.

Upvotes: 1

Views: 105

Answers (0)

Related Questions