The standard W3C recommendation for XQuery functions and operators requires them to count a surrogate pair as a single character. In SQL Server versions prior to 2012, XQuery string functions did not recognize surrogate pairs as a single character. For example, string length calculations returned incorrect results.
The XML data type in SQL Server only allows well-formed surrogate pairs. However, it is possible to pass invalid or partial surrogate pairs to XQuery functions as string values. Below is an example of providing surrogate pairs to XML data type variable through string values. The value of the CustomerName element is “