[python-win32] unable to read mssql varchar(max)

Vernon Cole vernondcole at gmail.com
Thu May 27 19:26:27 CEST 2010


I ran into the same problem using adodbapi. I tracked it down to the COM
call which errored out, and decided that maybe it was a Microsoft problem
and ignored it, just leaving the application broken on that feature.  If
pyODBC can do it, then the problem must be in the COM routines in pywin32.
  I can throw together a quick example of the failure if that will help with
debugging. It involves a sample SQL data table that must be imported for the
test and is not small (several recorded telephone calls as blobs)-- so I
will only do it if needed. Does anyone (Mark?) need it?
--
Vernon Cole

On Thu, May 27, 2010 at 10:18 AM, Preston Landers <planders at gmail.com>wrote:

> varchar(max) columns are like CLOBs, character large objects, and I'm not
> sure how well that odbc module handles them.   I ended up switching to
> pyODBC which does handle them.  Unfortunately it might not be just a drop-in
> replacement, and pyODBC does have its own issues.  But so far it's working
> pretty well for us.
>
> http://code.google.com/p/pyodbc/
>
>
>
> On Thu, May 27, 2010 at 10:56 AM, John <john at saponara.net> wrote:
>
>> Hi,
>>
>> When a ms sql server database column was changed to varchar(max), my
>> python code became unable to read that column.  no matter the actual value,
>> python sees it as '\x00'.  I use sql server 2008, python 2.4, and
>> pywin32-214.  it had worked when the column was a fixed size varchar, eg
>> varchar(1000).  essentially my code is:
>>
>> connectionString=r"driver={SQL Server Native Client
>> 10.0};server=...;uid=...;pwd=...;database=..."
>> connection=odbc.odbc(connectionString)
>> cursor=connection.cursor
>> cursor.execute("select ...")
>> cursor.fetchall()
>>
>> Could anyone suggest what the problem might be?
>>
>> Thanks,
>> John
>>
>>
>>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100527/378e320c/attachment.html>


More information about the python-win32 mailing list