blondebier
Programmer
Hi Guys,
I'm trying to pull together a query on an XML document in SQL Server 2005.
I have some XML like this :
<test_xml>
<element1 attribute="A" />
<element2 attribute="B" />
<element1 attribute="C" />
<element2 attribute="D" />
</test_xml>
Basically I want to find out whether there exists an element called "element2" and it's matching attribute is either "A", "B", "C" or "D"
I thought this would be pretty straight forward using the exists keyword.
i.e. @foundit = test_xml.exists('/test_xml[1]/element2[contains(@attribute, "A")]')
Can I specify all the required attribute values using "contains"?
Any tips would be most helpful.
Cheers,
Blondebier
I'm trying to pull together a query on an XML document in SQL Server 2005.
I have some XML like this :
<test_xml>
<element1 attribute="A" />
<element2 attribute="B" />
<element1 attribute="C" />
<element2 attribute="D" />
</test_xml>
Basically I want to find out whether there exists an element called "element2" and it's matching attribute is either "A", "B", "C" or "D"
I thought this would be pretty straight forward using the exists keyword.
i.e. @foundit = test_xml.exists('/test_xml[1]/element2[contains(@attribute, "A")]')
Can I specify all the required attribute values using "contains"?
Any tips would be most helpful.
Cheers,
Blondebier