Archive

Archive for June, 2015

How To : Parse repeating groups correlated by position as relational data

June 19, 2015 Leave a comment

Here’s a new post in the category “How to deal with that unfriendly design?”
Again, since the title is not very explicit, an example will surely explain it all :

<root>
  <ids>
    <id>7369</id>
    <id>7499</id>
    <id>7521</id>
  </ids>
  <names>
    <name>SMITH</name>
    <name>ALLEN</name>
    <name>WARD</name>
  </names>
  <jobs>
    <job>CLERK</job>
    <job>SALESMAN</job>
    <job>SALESMAN</job>
  </jobs>
</root>

This is the result we want out of that data :

   ID NAME    JOB
----- ------- ----------  
 7369 SMITH   CLERK
 7499 ALLEN   SALESMAN
 7521 WARD    SALESMAN

 

Read more…

Advertisements
Categories: HowTo, SQL, XQuery Tags: ,