Is there some way to transform/project XML from an XML column in the select clause of an Sql Server query?
Lets say we have a table with Id:Guid , Data:XML .
And lets say we have the following data in the "Data" column:
<Order>
<Details>
<Detail>
<Quantity>10</Quantity>
<ItemPrice>20</Quantity>
</Detail>
<Detail>
<Quantity>10</Quantity>
<ItemPrice>20</Quantity>
</Detail>
</Details>
</Order>
is there any way to project this (using a select + xquery) into , say for example:
<Order>
<Details>
<Detail>
<LineTotal>200</LineTotal>
</Detail>
<Detail>
<LineTotal>200</LineTotal>
</Detail>
</Details>
</Order>
I'm not interested in how this can be done in memory of my app, I want a server side transform in the select clause in the sql query.
<ItemPrice>20</ItemPrice>instead of<ItemPrice>20</Quantity>