Is it possible, using SQL Server 2014 Standard Edition, to PIVOT on the value of an XML column name? Ultimately I'd like to take this:
<table>
<id>{3d2699c4-3159-4e8b-b48c-c2c4c9b5bd77}</id>
<rows>
<row>
<columns>
<column name="DESC" value="DACS" type="System.String" />
<column name="ec_amount" value="5000" type="System.Decimal" />
<column name="ec_exrate" value="1" type="System.Decimal" />
<column name="ec_total" value="5000.00" type="System.Decimal" />
<column name="ItemNo" value="PVT-C30" type="System.String" />
<column name="UOM" value="EA" type="System.String" />
<column name="DefaultKey" value="1" type="System.Int32" /><----THIS IS THE COLUMN ON WHICH I WOULD LIKE TO PIVOT
</columns>
</row>
<row>
<columns>
<column name="DESC" value="DACS" type="System.String" />
<column name="ec_amount" value="1500" type="System.Decimal" />
<column name="ec_exrate" value="5" type="System.Decimal" />
<column name="ec_total" value="7500.00" type="System.Decimal" />
<column name="ItemNo" value="PVT-C30" type="System.String" />
<column name="UOM" value="EA" type="System.String" />
<column name="DefaultKey" value="2" type="System.Int32" />
</columns>
</row>
</rows>
<key>DefaultKey</key>
<total>12500.00</total>
<data />
<parameters />
</table>
....and create these results:
DefaultKey DESC ec_amount ec_exrate ec_total ItemNo UOM
1 DACS 5000 1 5000 PVT-C30 EA
2 DACS 1500 5 7500 PVT-C30 EA
I've searched the Stack Overflow site and of everything I came across, these two posts came close, but they don't quite get me there:
How do I Pivot on an XML column's attributes in T-SQL
My apologies if this has already been addressed and I simply gave up too soon.