I’m trying to select data from a table defined similar to the following :
Column | Data Type ------------------------- Id | Int DataType | Int LoggedData | XML
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.
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.
EDIT _ Clarification
So, what I’m after is something like this, but in the correct format…
select Id, LoggedData from myTable where DataType = 29 and LoggedData.query('RootNode/ns1:ChildNode[@value='searchterm']');
Still might not be clear…
If you want to filter by a searchterm (like a SQL variable) you will probably need to use something like this:
where @searchterm is your SQL variable.