I'm using pymssql 1.0.1 (on Python 2.4.5) and FreeTDS 0.82 under Ubuntu 8.04.2 Server to connect this machine to a remote MS SQL Server 2000 database.
I make connection with no problems but, using this code:
import pymssql
conn = pymssql.connect(host='myhost', user='myuser', password='mypassword', database='mydatabase')
cur = conn.cursor()
cur.execute('SELECT TOP 2 * FROM tablename WHERE columnname=LAMACCHIA')
rows = cur.fetchall()
print rows
conn.close()
I get:
pymssql.DatabaseError: internal error: SQL Server message 207, severity 16, state 3, line 1:
The column name 'LAMACCHIA' is invalid (I'm translating from Italian, here).
DB-Lib error message 207, severity 16:
General SQL Server error: Check messages from the SQL Server
columname contains 32 chars length values. If I try a query without a WHERE section I have no problems.
how can I fix this?
thank you very much. :)
greetings
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi all,
I'm using pymssql 1.0.1 (on Python 2.4.5) and FreeTDS 0.82 under Ubuntu 8.04.2 Server to connect this machine to a remote MS SQL Server 2000 database.
I make connection with no problems but, using this code:
import pymssql
conn = pymssql.connect(host='myhost', user='myuser', password='mypassword', database='mydatabase')
cur = conn.cursor()
cur.execute('SELECT TOP 2 * FROM tablename WHERE columnname=LAMACCHIA')
rows = cur.fetchall()
print rows
conn.close()
I get:
pymssql.DatabaseError: internal error: SQL Server message 207, severity 16, state 3, line 1:
The column name 'LAMACCHIA' is invalid (I'm translating from Italian, here).
DB-Lib error message 207, severity 16:
General SQL Server error: Check messages from the SQL Server
columname contains 32 chars length values. If I try a query without a WHERE section I have no problems.
how can I fix this?
thank you very much. :)
greetings
I think you need to quote 'LAMACCHIA'
cur.execute("SELECT TOP 2 * FROM tablename WHERE columnname='LAMACCHIA'")
stefano