Click here to Skip to main content
16,017,193 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
SELECT distinct(a.customerid),a.*,b.* from nop_customer a,nop_customerattribute b where a.customerid = b.customerid and a.email like @Value + '%' or a.username like @Value + '%' or (b.[key] like 'FirstName' and b.value like @Value + '%')


When i fire this query in the database i get this error:
Msg 421, Level 16, State 1, Procedure Nop_GetCustomerAttributesBySearch, Line 17
The xml data type cannot be selected as DISTINCT because it is not comparable.
Posted
Updated 26-Jun-10 4:51am
v4

1 solution

"The xml data type cannot be selected as DISTINCT because it is not comparable."
Error itself is self explanatory!

You are trying to use DISTINCT keyword with a field that has a datatype of 'XML'.
SQL does not allow DISTINCT with that field and thus the error.

If actually DISTINCT is needed (based on the way it is formed looks like can be left out), then you need to form the query someother way. Try to use a MAX, TOP or so based on certain field when duplicates are there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900