I have searched thoroughly and not found any examples or guidance on how I can query and retrieve the values of multiple XML siblings.
There are plenty of examples on how to retrieve a single sibling value.
For example given the following XML fragment:
<StoreSurvey>
<AnnualSales>800000</AnnualSales>
<AnnualRevenue>80000</AnnualRevenue>
<BankName>United Security</BankName>
<BusinessType>BM</BusinessType>
<YearOpened>1996</YearOpened>
<Specialty>Mountain</Specialty>
<SquareFeet>21000</SquareFeet>
<Brands>2</Brands>
<Internet>ISDN</Internet>
<NumberEmployees>13</NumberEmployees>
<Products Type="Bikes">
<Product>Mountain</Product>
<Product>Road</Product>
<Product>Racing</Product>
</Products>
<Products Type="Clothes">
<Product>Jerseys</Product>
<Product>Jackets</Product>
<Product>Shorts</Product>
</Products>
</StoreSurvey>
If I want to retrieve the value of <AnnualSales>, I can execute the following statement in query analyzer:
SELECT Survey_untyped.query('/StoreSurvey/AnnualSales')
FROM Stores;
The result set will properly display
<AnnualSales>800000</AnnualSales>
However, what if I want to retrieve both <AnnualSales> AND <AnnualRevenue>? How would I do that?
The query should provide a result set looking like:
<AnnualSales>800000</AnnualSales>
<AnnualRevenue>80000</AnnualRevenue>
Or what if I want three of the sibling values “BankName” in addition to those values? Result set would look like this:
<AnnualSales>800000</AnnualSales>
<AnnualRevenue>80000</AnnualRevenue>
<BankName>United Security</BankName>
Does anyone know the answer to that?