Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to get values from XML in this situation

$
0
0

Dear All,

<H>
<G N="a" sr="1" Visible="True"  Dc="a1">
          <Co N="abc1" sr="1" Visible="True"  Dc="abc11" />
          <Co N="abc2" sr="2" Visible="True" Dc="abc22" />
</G>
<G N="b" sr="2" Visible="True"  Dc="b1">
          <Co N="abc1" sr="1" Visible="True"  Dc="abc11" />
          <Co N="abc2" sr="2" Visible="True" Dc="abc22" />
</G>
</H>

I have to get following result in a table

GN     GDc  Gsr  N        Dc          sr

a       a1    1     abc1   abc11    1

a       a1    1     abc2   abc22    2

b       b      2     abc1    abc11   1

b       b      2     abc2    abc22   2

currently i have written two queries to get <G/> in one table

and <Co/> in second query.

what i want  to know , can we get above result in one  stmt.

yours sincerely

   



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>