Consultor Eletrônico



Kbase P57396: WORKAROUND for Error 6227 while running a query against SQL Server database against Unicode data typ
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/11/2010
Status: Verified

SYMPTOM(s):

Error 6227 occurs while running a query against SQL Server database

Error 6227 can also occur while trying to pull table definitions from SQL Server

SYSTEM ERROR: Unicode unsupported. Bad datatype <datatype>. (6227)

SYSTEM ERROR: _type_sqlc: Bad datatype <datatype> (6227)

Bad datatype -8 (6227)

Bad datatype -9 (6227)

Bad datatype -10 (6227)

Bad datatype -11 (6227)

FACT(s) (Environment):

Windows
Progress 9.1x
OpenEdge 10.0x
OpenEdge 10.1A
OpenEdge 10.1B
ODBC DataServer

CAUSE:

Error 6227 occurs when a data type was not recognized by Progress. The DataServer ODBC / MS SQL Server does not support the Unicode (UTF-8) data types (column that has the 'N' type data type (nchar, nvarchar, ntext / nlongvarchar) or uniqueidentifier.

These data types are returned from the ODBC driver as -8, -9, -10 and -11 datatypes respectively, which is reflect in the 6227 error message.

FIX:

Option #1
Uses the SQL Server's CAST function and the SQL passthrough feature in the DataServer.

DEFINE VAR handle1 AS INTEGER NO-UNDO.

RUN STORED-PROC send-sql-statement handle1 = PROC-HANDLE ("select cast (_nvarchar_field_ as varchar) from table").

FOR EACH proc-text-buffer WHERE PROC-HANDLE = handle1:
DISPLAY proc-text-buffer.
END.

CLOSE STORED-PROC send-sql-statement WHERE PROC-HANDLE = handle1.

Option #2 - if data only required for display
Create a View in SQL Server and use the CAST function to change Unicode data-type to non-Unicode equivalent.
Update the Schema Holder and add the View.