XML Shredding to include attribute and inner element value

masterbeats

New Member
Consider the following XML fragment: \[code\]<Orders> <Totals> <Total Type="Merchandise">56.89</Total> <Total Type="Shipping">10.75</Total> <Total Type="Tax">0.00</Total> <Total Type="Order">67.64</Total> <Total Type="Discount">0.00</Total> <Total Type="ServiceFee">0.00</Total> <Total Type="ServiceFeeDiscount">0.00</Total> </Totals> </Orders>\[/code\]I'd like to (using SQL's built in XQuery/XPath support), shred the Type attribute and the value of each Total into its own column and the inner value of each element into its own column, as seen below:\[code\] Type Amount Merchandise 56.89 Shipping 10.75 Tax 0.00 \[/code\]I've used all of the XQuery and XPath I know, to no avail. Any assistance would be greatly appreciated!
 
Back
Top