Solved

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

Posted on 2011-09-12
3
1,381 Views
Last Modified: 2012-06-21
Hi,

I have a 3 tables and get the values using RIGHT OUTER JOIN for my requirements.

I can get the correct value as what i need. But values are coming with duplication. So avoid duplication i will put group by for two columns that datatype is xml. I got the below error when i select the query. I already saw the solution in this forum. But it is not working for me. I got the same problem. Hope you understand my problem.

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

Regards
Guvera
0
Comment
Question by:guvera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36521838
this should do it:

group by CAST(your_xml_field as VARCHAR(MAX))
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 36521845
you might though want to read this article to check for alternatives for the GROUP BY, which might also be more efficient:
http://www.experts-exchange.com/A_3203.html
0
 
LVL 8

Author Closing Comment

by:guvera
ID: 36522112
Thanks
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question