I have the following query that allows me to get xml data from ONE row of xml from a specified column.
However, Product can have 1 UPC child, or a lot.
How can I alter my query to return all the existing children of Product?
DECLARE @MyXML XML
SET @MyXML =
(SELECT ProductsXML
FROM Products
WHERE ProductId= 1)
SELECT
a.b.value('Product[1]/UPC[1]/@upccode','DATE') as UPC,
a.b.value('Product[1]/UPC[1]/@dateadded','DATE') as DateAdded
FROM @MyXML.nodes('xml')a(b)
1 Answer