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.

asked 21 Jan '13, 12:20

Volker%20Barth's gravatar image

Volker Barth
accept rate: 32%

edited 21 Jan '13, 12:21

Any more insights would still be appreciated:)

(22 May '13, 10:03) Volker Barth

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.

permanent link

answered 23 May '13, 10:46

Jeff%20Albion's gravatar image

Jeff Albion
accept rate: 24%

edited 27 May '13, 12:47

Volker%20Barth's gravatar image

Volker Barth

OK, yes, I've not noticed the self-reference to "supported XPath" expressions... - thanks for the clarification.

(23 May '13, 10:58) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 21 Jan '13, 12:20

question was seen: 3,398 times

last updated: 27 May '13, 12:47