XML value query in SQL Server 2005

Say I have a column in a table where the data type is XML. I have a specific value that I want to get in an XML tag that is unique (not repeated) in XML. How should I do it?

Sort of:

select * from MyTable 
 where XMLColumn.TagImLookingAt.Value = @QueryValue
+3
source share
1 answer

Using:

WHERE xmlcolumn.value('(/path/to/tag)[1]', 'int') = @QueryValue

Change the data type to whatever suits you.

For more information, see the documentation - in particular, the methods available when working with the XML data type ...

+5
source

Source: https://habr.com/ru/post/1762337/


All Articles