Problem with odbc and Sql Server
frank at chagford.com
Mon May 22 08:51:55 CEST 2006
Frank Millman wrote:
> Hi all
> I have found a problem using MS Sql Server connecting via the odbc
> module from python-win32.
> Assume a table 't1' with a column 'c1' of type varchar(10).
> >From Python, set c1 to an empty string -
> cur.execute("UPDATE t1 SET c1 = ?",[''])
> The result is that c1 is actually set to a string of 10 spaces.
> If I execute the command without using parameters -
> cur.execute("UPDATE t1 SET c1 = ''")
> it works - c1 is set to an empty string.
Thanks for the replies, Andrew and Dennis.
I looked at Access Data Object, but I see that it uses OLE-DB to
connect to the database, and this would not be a valid comparison, so I
did not pursue that route.
Then I followed Andrew's suggestion of trying mx.ODBC - I should have
thought of that in the first place.
Using exactly the same connection string, and exactly the same sql
commands, it works correctly, where win32 odbc does not work correctly.
That seems to indicate that the problem lies with win32. I will advise
Mark of the result.
More information about the Python-list