I want to select the records from the Orders table. It contains the OrderXML as XML type column.
if OrderXML has order with status given by user then it should select the record. I am trying following query but not working -
SELECT *
FROM ORDER
WHERE ORDERXML.EXISTS('/Order/header/status/text()="Processing"') = 1
You need to put the predicate within brackets and exist
need to be lower case. XML is case sensitive and even the XML function names in SQL Server is case sensitive.
select O.*
from [Order] as O
where O.OrderXML.exist('/Order/header/status[text() = "Processing"]') = 1