Code:
DECLARE @myXML XML
SET @myXML = '<SampleXML>
<Product EffectiveDate="2007-01-01" ProductCode="030" />
<Product EffectiveDate="2008-01-03" ProductCode="030" />
<Product EffectiveDate="2007-01-10" ProductCode="030" />
<Product EffectiveDate="2007-01-20" ProductCode="090" />
<Product EffectiveDate="2007-01-01" ProductCode="090" />
<Product EffectiveDate="2005-10-01" ProductCode="090" />
<Product EffectiveDate="2011-01-21" ProductCode="0BA" />
<Product EffectiveDate="2007-01-01" ProductCode="0BA" />
</SampleXML>'
select @myXML.value('(/SampleXML/Product/@EffectiveDate)[1]', 'datetime')
Is there any way that I can get all the values for Effective Date? With the query I have I am passing [1]
I'd like to get all the Product Code values also.