The error "10427 Conversion of parameter/column (n) from data type NVARCHAR to ASCII failed" might occur when you read SAP HANA tables


When you read a SAP HANA table using SAS/ACCESS® Interface to SAP HANA, an error similar to the following might occur:

ERROR: CLI cursor extended fetch error: [SAP AG][LIBODBCHDB SO][HDBODBC] General error -10427 Conversion of parameter/column (n) from data type NVARCHAR to ASCII failed.
 
The conversion error is likely to be a problem with the content of the column specified in the N location in SAP HANA. This SAS KB article describes how to handle this error when it is caused by the following content being present in the specified column:

The ASCII conversion of the HANA client software is triggered by the following column data type definitions:

If the data type is defined as NVARCHAR in SAP HANA, the only way to read the column is to invoke SAS using UTF-8 session encoding. 

To invoke SAS using UTF-8 encoding from the Microsoft Windows Start menu, select All Programs ► SAS ► Additional Languages ► SAS 9.4 (Unicode Support).

You can also complete these steps to invoke SAS using UTF-8:

  1. Right-click the SAS shortcut icon and select Properties.
  2. In the Target field, use the right arrow key (not the space bar) to move to the last character in the string.
  3. Add a space and enter the full path to the UTF-8 configuration file:
       -config "C:\Program Files\SASHome94\SASFoundation\9.4\nls\u8\sasv9.cfg"
  4. Click OK.

To confirm the session encoding after invocation, run the following code:

 PROC OPTIONS OPTION=ENCODING; RUN;
 

On UNIX platforms, the following SAS invocation scripts are located in the !SASROOT\bin\ directory:

Here are resources that describe the impact of a change to UTF-8 SAS session encoding: