Well, I've remedied this problem for the time being, but need a real solution:
How can you insert into a table that has a text data type field, from a table with a text data type field, where you must select DISTINCT?
I tried:
The select distinct phrase works fine on its own. But with the insert it fails with a "The text, ntext, or image data type cannot be selected as DISTINCT" error.
I tried changing the table2 textfield to varchar(2000), and still got the same failure message. It was not until I changed the table1 textfield to a varchar() that I was able to get the insertion to work. (Does this make sense?!?)
We really need to keep that textfield a text data-type. And often don't have control over the source data. Is there a solution?
Cheers,
Kris
How can you insert into a table that has a text data type field, from a table with a text data type field, where you must select DISTINCT?
I tried:
Code:
insert into table1
(field1, field2, textfield1)
select DISTINCT field1, field2, convert(varchar(2000),textfield2) from table2
The select distinct phrase works fine on its own. But with the insert it fails with a "The text, ntext, or image data type cannot be selected as DISTINCT" error.
I tried changing the table2 textfield to varchar(2000), and still got the same failure message. It was not until I changed the table1 textfield to a varchar() that I was able to get the insertion to work. (Does this make sense?!?)
We really need to keep that textfield a text data-type. And often don't have control over the source data. Is there a solution?
Cheers,
Kris