The text data type cannot be selected as DISTINCT because it is not comparable

2009-05-02


When I tried to select a table which includes a text type field using distinct. I got these error:

The text data type cannot be selected as DISTINCT because it is not comparable
The solution is convert text to VARCHAR(MAX).
CONVERT(VARCHAR(MAX), text_type_filedname)
Varchar(Max) is a LOB datatype and has a max size of 2GB.