Querying xml data with SQL



I have a table in Microsoft SQL Server 2005 with column of datatype
xml. The xml may contain multiple elements of the same type, e.g.
multiple <child> elements for a single <parent>. How can I query on the
<child> elements?

For example, what would be the correct syntax for this query where both
parent and child are elements within the xml...

SELECT parent FROM MY_XML_TABLE WHERE child='A' OR child='B'

I've already had a play around with xml.value and xml.nodes - but I
think I'm missing something crucial!

Many thanks for your help,

Cathy

.



Relevant Pages

  • Re: Editting an XML file
    ... I have an overriden XmlDocument. ... A whole segment of my XML is disappearing during my save. ... Here is an example how you could build your own method to find child ... static ArrayList GetChildElements (XmlNode node, ...
    (microsoft.public.dotnet.xml)
  • Re: Editting an XML file
    ... I did try GetElementByTagName but gave up on that, ... A whole segment of my XML is disappearing during my save. ... Here is an example how you could build your own method to find child ... static ArrayList GetChildElements (XmlNode node, ...
    (microsoft.public.dotnet.xml)
  • Re: XML Question
    ... > Hello Hardy, ... > element node is a node with at most one child whose node type is Text. ... I have following piece of XML file, ... >> ICQ: 3359839 ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Timing Rescordset
    ... I just read data into arrays, ... The problem was that it took hours to read a big xml file. ... I'm guessing that Bob found that node_text is exposed as a child node the ... avoid levels of recursion that lack substantial advantage. ...
    (microsoft.public.data.ado)
  • Re: Mozilla Vs IE for childNodes.length
    ... Mozilla for XML and HTML document includes whitespace between elements ... then the status element as the second child ... elements then ignore the childNodes collection and simply use ...
    (comp.lang.javascript)