Error querying linked server

  • Moderator
  • Topic Author
  • Offline
  • New Member
More
8 years 8 months ago #13817 by Moderator
Error querying linked server was created by Moderator
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.150 seconds
Powered by Kunena Forum