Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When I run the following statement:

Status
Not open for further replies.

mikeyd

Technical User
Jan 28, 2002
38
US
When I run the following statement:

*************************************************

SELECT CONTACT1.CONTACT AS Contact, CONTACT1.COMPANY AS Company, CONTACT1.ADDRESS1 AS Address1, CONTACT1.ADDRESS2 AS Address2, CONTACT1.ADDRESS3 AS Address3, CONTACT1.CITY AS City, CONTACT1.STATE AS State, CONTACT1.ZIP AS Zip, CONTACT1.COUNTRY AS Country, CONTACT1.TITLE AS Job_Title,
CONTACT1.PHONE1 AS Direct_Line, CONTACT1.KEY3 AS OSA, CONTACT2.UCONTCTROL AS Contacts_Role, CONTSUPP.Notes,
min(contsupp.rectype) as Rectype, min(CONTSUPP.CONTSUPREF) AS Email

FROM CONTACT1 INNER JOIN CONTACT2 ON CONTACT1.ACCOUNTNO = CONTACT2.ACCOUNTNO LEFT OUTER JOIN CONTSUPP ON CONTACT2.ACCOUNTNO = CONTSUPP.ACCOUNTNO
WHERE CONTACT1.CONTACT like '*main%'

GROUP BY CONTACT1.CONTACT, CONTACT1.COMPANY, CONTACT1.ADDRESS1, CONTACT1.ADDRESS2, CONTACT1.ADDRESS3,
CONTACT1.CITY, CONTACT1.STATE, CONTACT1.ZIP, CONTACT1.COUNTRY, CONTACT1.TITLE,
CONTACT1.PHONE1, CONTACT1.KEY3, CONTACT2.UCONTCTROL

***************************************************

I get the following error:

Server: Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.

It is the 'CONTSUPP.Notes' field that it appears to have the problem with because it is a 'text' datatype. The trouble is, that I want to include this column in my query. Does anyone have any suggestion how I can iclude this column of 'text' datatype.

NOTE: This is probably worth more than 50 points, but i'm all out! Sorry!

Thanks in advance for the help, i'm new to playing with MSSQL, as you have probably noticed.
 
Please do not post the same question twice. (other post is Thread183-667620).

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top