XML Datatype Method – exist()
The exist() method returns a bit as follows
1, this means the XQuery expression in a query returns a result which is at least a xml node.
0, this means it’s a empty result
NULL, this means that it was executed against a NULL value.
The Syntax is
exist (XQuery)
The below shows how to check if the JobID 1 exists
SELECT JobHistory.exist('/Job[@JobID=1]') FROM Employee
1, this means the XQuery expression in a query returns a result which is at least a xml node.
0, this means it’s a empty result
NULL, this means that it was executed against a NULL value.
The Syntax is
exist (XQuery)
The below shows how to check if the JobID 1 exists
SELECT JobHistory.exist('/Job[@JobID=1]') FROM Employee
Comments