XMLQUERY is an SQL scalar function that enables you to execute an XQuery expression from within an SQL context. You can pass variables to the XQuery expression specified in XMLQUERY. XMLQUERY returns an XML value, which is an XML sequence. This sequence can be empty or contain one or more items.
Refer to the documentation on the comparison of querying methods for more details.
Note that XQuery is case-sensitive, so the XQuery expressions and variables specified in XMLQUERY must be carefully specified.
For cases where the full functionality for passing SQL expressions is not needed, a simpler syntax for passing column names without having to specify the names in the passing clause explicitly is aso available. See Simple column name passing with XMLEXISTS, XMLQUERY, and XMLTABLE.