Advertisement

12.13.2006 at 05:55PM PST, ID: 22092779
[x]
Attachment Details

SQL 2005:  The data types text and varchar are incompatible in the equal to operator

Asked by Memorix in MS SQL Server

Tags: , , , ,

Hi,

I've wrote a search module for SQL Server 2000 a while back and it produces queries like:-

SELECT tblSection.SectionShortDesc as SectionShortDesc, tblPage.PageID, tblPage.PageName, tblPage.PageTitle
FROM (tblPage INNER JOIN tblPage2Section ON tblPage.PageID = tblPage2Section.PageID)
INNER JOIN tblSection ON tblPage2Section.SectionID = tblSection.SectionID
WHERE ((CHARINDEX('test', CONVERT(varchar(8000), tblSection.SectionShortDesc, 103)) > 0))
AND PageCat <> 'Products' AND PageCat <> 'Weight Watchers'
ORDER BY tblPage.PageTitle, tblPage.PageID, tblPage.PageName;

This query works fine on several sites running SQL Server 2000.  I am now needing to implement this same functionality on SQL 2005 but when i execute this query i get the following error message

#####################################

Microsoft OLE DB Provider for SQL Server error '80040e14'

The data types ntext and varchar are incompatible in the add operator.

/walkerssql/index.asp, line 1627

#####################################

I've tried changing CONVERT(varchar(8000), tblSection.SectionShortDesc, 103) to CONVERT(nvarchar(max), tblSection.SectionShortDesc, 103) as i've seen in several articles on google but it still give the same result.

Any suggestions on how to resolve this?Start Free Trial
[+][-]12.13.2006 at 06:26PM PST, ID: 18135953

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.13.2006 at 06:27PM PST, ID: 18135959

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.13.2006 at 10:52PM PST, ID: 18137056

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.14.2006 at 01:52PM PST, ID: 18142455

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.14.2006 at 04:36PM PST, ID: 18143392

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.14.2006 at 08:42PM PST, ID: 18144368

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.17.2006 at 12:19PM PST, ID: 18155420

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]12.23.2006 at 06:52PM PST, ID: 18193363

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: data, incompatible, types, varchar, text
Sign Up Now!
Solution Provided By: PashaMod
Participating Experts: 4
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32