<p>I'm trying to select data from a table defined similar to the following :</p>

<pre><code>Column     |    Data Type
-------------------------
Id         |    Int
DataType   |    Int
LoggedData |    XML
</code></pre>

<p>but I only want to select those rows with a specific DataType value, and that contain a string (or evaluates a piece of XPath) in the LoggedData column.</p>

<p>A quick Google search turned up nothing useful, and I am in a bit of a rush to get an answer...  I'll carry on searching, but if anyone can help me out on this in the mean time, I'd really appreciate it.</p>

<p><strong>EDIT</strong> _ Clarification</p>

<p>So, what I'm after is something like this, but in the correct format...</p>

<pre><code>select Id, LoggedData from myTable where DataType = 29 and LoggedData.query('RootNode/ns1:ChildNode[@value="searchterm"]');
</code></pre>

<p>Still might not be clear...</p>

Is this not doing the trick for you?
```
```
SELECT
  Id, 
  LoggedData 
FROM
  myTable 
WHERE
  DataType = 29 
  AND LoggedData.exist('RootNode/ns1:ChildNode[@value="searchterm"]') = 1
```
```