SQL Sum all float nodes in XML



I have xml like below:



<float52>7.667000000000000e+003</float52>
<float59>7.667000000000000e+003</float59>
<float60>3.766700000000000e+004</float60>
<ntext2>Other</ntext2>
<nvarchar3>Idea</nvarchar3>
<nvarchar4>Budget</nvarchar4>


I need to sum all the float nodes within this xml. I can extract each float like this:



@xml.value('(/float52/node())[1]','float') as FloatValue


but how can i sum all these float nodes without hard-coding column names?


No comments:

Post a Comment