XML file
<?xml version="1.0" encoding="utf-8"?>
<Data>
<ProductID>
<Producer value="SomeName" />
<Locality value="California" />
<Chamber value="ATK-01B" />
<System value="CAL-ATK-01B-01" />
</ProductID>
</Data>
The above is the XML file gets saved in the column content of a SQL Server table. I am using the below query to select the records from DB with value CAL-ATK-01B-01.
Query:
SELECT *
FROM [Table name]
WHERE [xmlBody].value('(/Data/ProductID/System)[1]', 'varchar(max)') LIKE 'CAL-ATK-01B-01';
I need to select all records with matching value in xml file as "CAL-ATK-01B-01". But the query I tried is returning empty value.
Can any one help me do this?
Thanks