?
Solved

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

Posted on 2006-04-05
13
Medium Priority
?
1,590 Views
Last Modified: 2012-08-13

select * from notes where comment = 'Status change gg toyy'

the stupid comment field in this system is type text in SQL so how do I get around this error:

The data types text and varchar are incompatible in the equal to operator.
0
Comment
Question by:dba123
  • 7
  • 3
  • 3
13 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1200 total points
ID: 16384877
you need to use 'Contains '
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 800 total points
ID: 16384883
please try this:
select * from notes where substring(comment, 1, 500) = 'Status change gg toyy'

if you don't need to store strings longer than 8000 characters in the notes field, change it to varchar(8000)  if you are using sql server 2000, with sql server 2005 use varchar(max) instead
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16384890
>you need to use 'Contains '
that is only working if the field "notes" has been added into a full-text search catalog !
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:dba123
ID: 16384891
select * from notes where comment CONTAINS 'Status change gg toyy'
0
 
LVL 1

Author Comment

by:dba123
ID: 16384907
I'd love to get rid of the text field Angel but this is a stupid s***ty ass 3rd party piece of S**t
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 16384909

SELECT *
FROM notes
WHERE CONTAINS(ProductName, '"Status change gg toyy" ')
0
 
LVL 1

Author Comment

by:dba123
ID: 16384913
It's amazing how these 3rd party companies out there today (even IBM with their s***ty ass ClearQuest) can charge a ton for such a S**ty application design.
0
 
LVL 1

Author Comment

by:dba123
ID: 16384916
time for me to go into business??  anyone want to hop aboard...jk
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 16384922
As angel suggested , you should enable full text indexing on 'Comments'
0
 
LVL 1

Author Comment

by:dba123
ID: 16384941
yea, well I don't know if that will break the system for this API that I don't work with....I could enable that but if our network guys start to get calls on slow performance then guess who they come to first!
0
 
LVL 1

Author Comment

by:dba123
ID: 16384950
sorry for all the swearing, I just can't believe what I see in 3rd party apps these day...disgusting.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16384962
if you don't dare implementing the full-text search on it (btw, I doubt this will not be working anyhow for exact match), you should try out my very first comment
0
 
LVL 1

Author Comment

by:dba123
ID: 16445280
Thanks much!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question