1

How to add second condition to the following query?

SELECT c.value('@tray','VARCHAR(MAX)')
  FROM @L_XML.nodes('/XDOC/DOC[@TYPE="Q"]') T(c)     

so that I could filter on attribute: type = Q or S?

Where Can I find a detailed manual about xml nodes?

John
  • 1,834
  • 5
  • 32
  • 60

2 Answers2

3
SELECT c.value('@tray','VARCHAR(MAX)')
FROM @L_XML.nodes('/XDOC/DOC[@TYPE = ("Q", "S")]') T(c)  
Mikael Eriksson
  • 136,425
  • 22
  • 210
  • 281
1

A very good starting point is SQLXML where an exhaustive list of basic reads and writes are covered on a How To basis. Quite handy and certainly worth a bookmark in my book!

In regard to your first question: have a look here, that might give you what you're looking for. I think your problem might be in the quotes.

Community
  • 1
  • 1
Wim Ombelets
  • 5,097
  • 3
  • 39
  • 55
  • The problem is how to add second condition to the existing one. Neither don't know if it is possible, nor what is the right syntax... – John May 16 '13 at 12:45
  • SQLXML has not been updated in about ten years and only seems to address SQL 2000. – Sebastian Meine May 16 '13 at 12:57