How do I encode Unicode strings using pyodbc to save to a SAS dataset?
Posted
by Chris B.
on Stack Overflow
See other posts from Stack Overflow
or by Chris B.
Published on 2010-05-24T20:48:15Z
Indexed on
2010/05/24
20:51 UTC
Read the original article
Hit count: 222
I'm using Python to read and write SAS datasets, using pyodbc
and the SAS ODBC drivers. I can load the data perfectly well, but when I save the data, using something like:
cursor.execute('insert into dataset.test VALUES (?)', u'testing')
... I get a pyodbc.Error: ('HY004', '[HY004] [Microsoft][ODBC Driver Manager] SQL data type out of range (0) (SQLBindParameter)')
error.
The problem seems to be the fact I'm passing a unicode string; what do I need to do to handle this?
© Stack Overflow or respective owner