How do I check against multiple values in XQuery
exist method? I'm running this XQuery
in a SQL statement
Select [column1] [xmlcolumn] from tablet
where [xmlcolumn].exist('/node/subnode/subsubnode[.="value1"]') = 1
I want to be able specify multiple values like [.="value1" OR "value2" OR ...]
.
Any pointers is appreciated.
Use:
exists(/node/subnode/subsubnode[. eq "value1" or . eq "value2"])
XPath is case-sensitive, the operator to use is "or"
-- not "OR"
.
If you have many values, it is more practical to use:
exists(/node/subnode/subsubnode
[. = ("value1","value2","value3","value4","value5")])