Search code examples
pythoncollationpymssql

pymssql BD collate, how change?


I get data from MS SQL server. on db proptis collate is set to: Polish_CI_AS

When I get data:

conn = pymssql.connect(host='xxx', user='xxx',
                       password='xxx', database='xxx',charset='UTF-8')
cur = conn.cursor()

cur.execute(
            "SELECT  column  \
             FROM xxx \
             where xxx is not null \
             and xxx <>'COMPLETED'")
data = cur.fetchone()

and there is not polish chars :(


Solution

  • OK, i find , maybe someone has the same problem.

    in the conenction string, I mus insert charset='CP1250' not charset='UTF-8'