Error querying linked server

More
3 years 10 months ago #13817 by Moderator
Moderator created the topic: Error querying linked server
When linked server query uses WHERE clause with "text column equal to string literal", the following error is returned:
"The data types ntext and varchar are incompatible in the equal to operator".

Example: select * from PG...varchartst WHERE ntxt = 'ntxt1'

Solution 1. Cast column to nvarchar(max): select * from PG...varchartst WHERE CAST(ntxt as nvarchar(max)) = 'ntxt1'.

Solution 2. Use LIKE operator without wildcard: select * from PG...varchartst WHERE ntxt LIKE 'ntxt1'

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum