The XML data type cannot be compared or sorted, except when using the IS NULL operator.

Posted on : 14-05-2012 | By : Devi Prasad | In : XML

0



Error:

Msg 305, Level 16, State 1, Line 1
The XML data type cannot be compared or sorted, except when using the IS NULL operator.

Reason for this error message:
1) Comparing XML Data type Columns/Variables.
2) Sorting based on XML Data types

Example Queries:

DECLARE @A XML
DECLARE @B XML

SELECT 1 WHERE @A = @B

Fix/Resolution:
1) Check if the query contains direct comparisions based on XML Data type columns/Variables.
1) Check if the query uses xml datatype in the order by clause.
3) Cast the XML Datatypes to varchar(or some other compatable form) and Compare/sort.
2) Use xquery to Compare/sort XML Data types values indirectly.




Reference : Devi Prasad (sqlserverlearner.com)

Do you like my blog?

If you liked reading this blog, please help spread the word by sharing this blog with your friends.



Need Help On SQL Server?

Cannot Find Solution to your problem (or) If you are looking for some help on SQL Server. Dont worry Click Here to Post your question and solve your issue.




Your Ad Here


Tags: , , , ,