Error querying linked server

  • Moderator
  • Topic Author
  • Offline
  • New Member
9 years 2 weeks 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.131 seconds
Powered by Kunena Forum