ODBC question from Python Newbie

uncleleo uncleleo at billsfan.net
Thu May 10 12:23:31 EDT 2001


I was attempting to insert a row into a Microsoft SQL server table.  Using
the Sam Rushing's ODBC with DynWin.  Inside this table are 3 fields and all
of them varchars.  One of the fields was intended to hold a root directory,
e.g. c:\service\system.py.

>>> sql.query('insert into app..application (Designator, Script) values
(8885551212, c:\\service\\test.py)')
 37000
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near
'c:'.
native error  170

This one errors.

>>> sql.query('insert into app..application (Designator, Script) values
(8885551212, "c:\\service\\test.py")')
37000
[Microsoft][ODBC SQL Server Driver][SQL Server]The name 'c:\service\test.py'
is not permitted in this context. Only constants, expressions, or variables
allowed here. Column names are not permitted.
native error  128

This one errors.

>>> sql.query('insert into app..application (Designator, Script) values
(8885551212, """c:\\service\\test.py""")')
37000
[Microsoft][ODBC SQL Server Driver][SQL Server]The name
'"c:\service\test.py"' is not permitted in this context. Only constants,
expressions, or variables allowed here. Column names are not permitted.
native error  128

This one also errors.  Now I can work around this issue, but now I would
like to know what is the real problem.  Can someone let me know if they have
come across this issue, if so how did you resolve it.





More information about the Python-list mailing list