|
|
Question : SQL 2005: The data types text and varchar are incompatible in the equal to operator
|
|
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?
|
Answer : SQL 2005: The data types text and varchar are incompatible in the equal to operator
|
|
Closed, 250 points refunded. PashaMod Community Support Moderator
|
|
|
|
|