Jim Horn
asked on
XQuery in SQL 2012: .exist with multiple criteria
How do you code in XQuery (SQL 2012) to do an .exist with multiple criteria?
Given the below XML..
Given the below XML..
Declare @x xml = '
<row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="page" itemValue="Confirmation" itemType="string" />
<row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="visited" itemValue="false" itemType="bool" />'
These two criteria work fine when queried individually...
SELECT @x.exist('/row[@Node eq "root.local.navigation[7]"]')
SELECT @x.exist('/row[@itemValue eq "Confirmation"]')
But when I combine them below it returns errmsg 'XQuery [exist()]: The XQuery syntax 'union' is not supported.'SELECT @x.exist('/row[@Node eq "root.local.navigation[7]"] | /row[@itemValue eq "Confirmation"]')
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.