BookmarkSubscribeRSS Feed
Ullsokk
Pyrite | Level 9

I am trying to update a table in a sql database from viya, using proc sql insert. However, the characters have turned into Chinese on the way from VIYA to the sql database.

 

Is this a known issue? I would guess this has something to do with encoding.

 

The same code works from SAS 9.4.

 

 

7 REPLIES 7
japelin
Rhodochrosite | Level 12

Hi,

First, please clarify the environment.

 

1. The encoding of SAS and the encoding of the original database in the environment where you checked it works.

2. what is the execution environment when garbled on Viya, SAS or other?

3. How were the databases created? Is it just a SAS dataset, a sql database, did you create it, is it an existing database, etc.?

 

Ullsokk
Pyrite | Level 9

1.The encoding in sas VIYA is UTF-8, as far as I am aware. The encoding in the MSSQL database is wlatin1, the same is true in our 9.4 environmen, where the code works.

 

2.The execution was from sas studio V 

 

3.The database is an existing MSSQL database 

japelin
Rhodochrosite | Level 12

Let me check something additional.

How are you connecting to the mssql database?
Is it sqlsvr with the access engine, or ODBC? Or is it some other way?
Also, what is the code for the part that is connecting to the database?

Ullsokk
Pyrite | Level 9

The conection is through ODBC

 


libname mssql odbc dsn="dsn" schema=schema user="user" password="pw"
cursor_type=forward_only;

 

from the odbc.ini:

 

[dsn]

Driver = ODBC Driver 17 for SQL Server

Server = servername

Database=database

AutoTranslate=yes

IANAAppCodePage=106

DriverUnicodeType=1

japelin
Rhodochrosite | Level 12

Try adding the following string to the end of the libname statement.

 

client_encoding='utf-8'

Ullsokk
Pyrite | Level 9

Tried it, in several locations in the libname statement. got the following error:

 

ERROR 22-7: Invalid option name CLIENT_ENCODING.

Ullsokk
Pyrite | Level 9

tried the option for a postgres example: 

libname mydb postgres server=myserver port=5432 
    user=myuser password='mypwd' database=mydb1 client_encoding='utf-8';

that gave no error regarding client_encoding. Is client_encoding maybe not supported in odbc?