Question : On Insert: The text, ntext, or image data type cannot be selected as DISTINCT

I have a select statement like so:

      SELECT DISTINCT varchar100field FROM tablename

It works just fine, until I try to insert this select statement into a table with a TEXT type field like so:

      INSERT INTO othertable (textfield)
            SELECT DISTINCT varchar100field FROM tablename

At which point I get the error "The text, ntext, or image data type cannot be selected as DISTINCT".

I can work around this by first inserting into a temp table or rewriting the code entirely, but I want to know if there is a correct way to do this without using a workaround, or if this is just a known limitation of SQLServer.

Answer : On Insert: The text, ntext, or image data type cannot be selected as DISTINCT

Yes as we pointed out in that thread, this is one of the many limitations of using the Text data type.
Random Solutions  
 
programming4us programming4us