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

Hi Ignition professionals,

I run the simple query as showing in the photo but I get the showing error all the time. Can you please advise to resolve this? Thanks.

You'll need to either cast or convert the Text column to varchar in the query.

UPDATE Ford_Raptor
SET Passenger_Rivnut_1_Torque = 12.0
WHERE CONVERT(varchar, Part_Number) = '123'
1 Like

Or convert the database column to varchar instead of text.


I'd recommend this way as you can't index a text column outside a FULLTEXT index. VARCHAR's behave more like other datatypes in this regard. Seeing as the column is Part_Number, I don't think you need to allow for 65k characters.

1 Like

@dkhayes117 has the right answer, but in the future, if there's a type mismatch between a column value and a supplied parameter, cast the parameter to the column's type, not vice versa. That way it will only be executed once when setting up the query, not for every row.


Thanks, everyone. It was great.