|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
The text, ntext, or image data type cannot be selected as DISTINCT
I have you use the DISTINCT in my sql select statement.
here is what I did: Set RS=Condata.Execute("SELECT DISTINCT course,title,Name,CRhr,inst_type,COU_DESC,long_des c FROM schedule WHERE subj='" & tsubj & "' ORDER BY course,title") I got the error: Microsoft OLE DB Provider for SQL Server </SPAN> (0x80040E14) The text, ntext, or image data type cannot be selected as DISTINCT. There is a field, Cou_Desc, uses Ntext datatype. If I change this field to Varchar then asp app works fine. The problem that if I change this field datatype, then something else will not work . The question is: Is there a way to make the sql statement works without changing the field datatype? Thanks very much for your help |
|
#2
|
||||
|
||||
|
Just cast it to a varchar.
Example: Code:
SELECT DISTINCT course, title, Name, CRhr, inst_type, CAST(COU_DESC As varchar(1000)) As COU_DESC, long_desc FROM schedule WHERE subj = '" & tsubj & "' ORDER BY course, title |
|
#3
|
|||
|
|||
|
Thanks. It ... works ! you're the best
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > The text, ntext, or image data type cannot be selected as DISTINCT |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|