on 2013 Jan 21 12:20 PM
A question similar to this one..
When using a predicate in a XPath query to test for a particular predicate (which is called a "qualifier" in the docs), am I limited to equality tests?
Equality tests like '//[EmployeeID="105"]' do work in my tests.
However, tests with "<=" or "!=" or combining predicates with " and " etc. do not work and raise syntax errors.
IMHO, the docs are a bit unclear (or my understanding of the term "expression" is too general here), stating that
Qualifiers of the form expr1[expr2] and expr1[expr2="string" ] can be used, where expr2 is any supported XPath expression. A qualifier evaluates TRUE if expr2 matches one or more nodes. For example, 'a[b]' finds a nodes that have at least one b child, and a[b="I"] finds a nodes that have at least one b child with a text value of I.
Again, the obvious workaround would be to defer these tests after the openxml() result set is built, and filter the result set with common WHERE conditions.
The drawback might be (but I'm not sure) that this is possibly less efficient.
or my understanding of the term "expression" is too general here)
Actually I think the issue here is the part where we add "supported XPath expression" to the definition, and we say in the paragraph before:
"The openxml system procedure supports a subset of the XPath syntax, as follows:"
Ultimately meaning that we do not support all XPath expressions / operators - including any non-equality operators. So yes, equality is the only test you can add to the OPENXML
XPath qualifier.
As per my answer over here, I have now made an enhancement request to look at further potential support for XPath queries in OPENXML (set operations, and boolean/comparison/set expressions) in CR #740332 for a future version of SQL Anywhere.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.