Reputation: 11319
Let's say I have a column in a table where the datatype is XML. I have a specific value I want query for in an xml tag that is unique(no repeating) in the XML. How do I do this?
Something like:
select * from MyTable
where XMLColumn.TagImLookingAt.Value = @QueryValue
Upvotes: 3
Views: 215
Reputation: 332791
Use:
WHERE xmlcolumn.value('(/path/to/tag)[1]', 'int') = @QueryValue
Change the data type to whatever is appropriate.
For more info, see the documentation - specifically the methods available when dealing with the XML data type...
Upvotes: 5