Thandava Vallepalli
asked on
How to query xml from xml variable?
Hello Experts,
I have a xml variable called @xmlstr in below code snippet.
I need to extract customer xml portion (as mentioned below) from OrderInfo xml and store it in a table.
<Customer>
<Name>First, Last</Name>
<Address>xyz, zip</Address>
</Customer>
Please help me how can i extract sub-xml portion from xml?
Regards,
itsvtk
I have a xml variable called @xmlstr in below code snippet.
I need to extract customer xml portion (as mentioned below) from OrderInfo xml and store it in a table.
<Customer>
<Name>First, Last</Name>
<Address>xyz, zip</Address>
</Customer>
Please help me how can i extract sub-xml portion from xml?
Regards,
itsvtk
declare @xmlstr xml
set @xmlstr =
'<OrderInfo>
<Customer>
<Name>First, Last</Name>
<Address>xyz, zip</Address>
</Customer>
<Product>
<Number>xyz123</Number>
<Name>Product Name</Name>
</Product>
</OrderInfo>'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A.Customers.value('(Custom
A.Customers.value('(Produc
A.Customers.value('(Produc
FROM @xmlstr.nodes('/OrderInfo'