I have tried in vain to adapt your advice to this XML:
1
1
25
2
25
3
50
I am trying to change the XML to a resultset like this:
sourceposition fundposition percent
1 1 25
1 2 25
1 3 50
If there are multiple source positions, I need those to display as additional rows, as well. This is the query that I tried, and I just get NULL values.
SELECT
x.value('(Field[@Name="sourceposition"]/@Value)[1]','VARCHAR(20)') AS sourceposition,
x.value('(Field[@Name="fundposition"]/@Value)[1]','VARCHAR(20)') AS fundposition,
x.value('(Field[@Name="percent"]/@Value)[1]','VARCHAR(20)') AS [percent]
FROM @x.nodes('/accountorder/source') d(x)
Thanks in advance for your help!
commented on Dec 1 2009 6:44PM