pymssql - insert NULL to int

rc chlo.prog at gmail.com
Wed Oct 17 11:49:06 EDT 2007


How to insert NULL values in to int field using params.

I'm trying to use pymssql.execute, passing the operation and list of
params.  One of the values in the params is a NULL value going to int
field.  The pymssql._quote() puts ' around the NULL which causes an
exception to be thrown, is there a way to use the params for this or
do I need to build the insert string myself?

pymssql.DatabaseError: internal error: SQL Server message 245,
severity 16, state 1, line 1:
Conversion failed when converting the varchar value 'NULL' to data
type int.
DB-Lib error message 10007, severity 5:
General SQL Server error: Check messages from the SQL Server.




More information about the Python-list mailing list