92 views

Description

In MS SQL, some queries show the following message:

"The data types varchar and ntext are incompatible in the equal operator."

The message occurs because non-integer fields are reported as NTEXT data type. On older versions of the ODBC driver, non-integer fields worked and the message was not displayed.

Steps to Reproduce

 

  1. Configure MS SQL with ODBC driver.
  2. Execute the following MS SQL query:

//----sql----
CREATE TABLE dbo.test_incident 

    short_description varchar(45) NULL, 
)  
ON PRIMARY; 

// the following command fails:
SELECT short_description INTO test_incident FROM incident;

//----sql----

MS SQL error 402: The data types ntext and varchar are incompatible in the equal to operator

Workaround

Casting the field to varchar makes it work correctly, for example:

//----sql----
SELECT cast(short_description as varchar) INTO test_incident FROM incident;
//----sql----


Related Problem: PRB1110116

Seen In

There is no data to report.

Fixed In

Kingston
London

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-07-23 16:07:04
Published:2017-08-25