Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sristau
Starting Member
1 Post |
Posted - 2009-02-18 : 19:02:23
|
| Hi All,I am new to SQL 2005, well not really new just not an expert. Below is a query I am trying to run however get an error "The data types text and varchar are incompatible in the equal to operator."Here is the query-select qanswer from optionalquestionanswers where userid='@System Variable,,,,USER_ID;' and entryid=(select entryid from optionalquestions where question='@System Variable,,,,CBOT_QUESTION;');Any help would be much appreciated... |
|
|
SQLforGirls
Starting Member
48 Posts |
Posted - 2009-02-18 : 19:22:33
|
| Somewhere you have a column or variable defined as datatype Text. Text is a LOB datatype and cannot be indexed, searched or compared. For instance,declare @variable1 varchar(100)declare @variable2 varhcar(1000)declare @variable3 textset @variable1 = 'Hello'set @variable2 = 'Hello'set @variable3 = 'Hello'You can compare @variable1 to @variable2: ... where @variable1 = @variable2 ...You cannot compare @variable3 with anything because the value 'Hello' is stored in a binary format that is not indexable or searchable.Check through your code, both SQL and front-end, and find the column or variable that has been defined as TEXT and change it to varchar(8000). If 8000 characters is not enough, you will not be able to do the type of comparison you are attempting.Hope that helps. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-19 : 03:13:13
|
| since you're using sql 2005, use varchar(max) instead of text datatype. the text datatype is deprecated in sql 2005 and its not advisable to use it. |
 |
|
|
|
|
|
|
|