I\'m having issues sending unicode to SQL Server via pymssql:
In [1]: import pymssql
conn = pymssql.connect(host=\'hostname\', user=\'me\', p
Here is something which worked for me:
# -*- coding: utf-8 -*-
import pymssql
conn = pymssql.connect(host='hostname', user='me', password='password', database='db')
cursor = conn.cursor()
s = u'Monsieur le Curé of the «Notre-Dame-de-Grâce» neighborhood'
cursor.execute("INSERT INTO MyTable(col1) VALUES(%s)", s.encode('latin-1', "ignore"))
conn.commit()
cursor.close()
conn.close()
MyTable is of collation: Latin1_General_CI_AS and the column col1 in it is of type varchar(MAX)
My environment is: SQL Server 2008 & Python 2.7.10