[python-win32] odbc giving None when the data in a row has string length more that 216 characters

siddhartha veedaluru siddhartha.veedaluru at gmail.com
Wed Oct 13 15:09:37 CEST 2010


Hi,

odbc retrieving value "None" when the data in a row has string length more
that 216 characters.
The Column AdditionalUpdates is of datatype ntext.
the value in it has a string length more than 216, which when retrieved
gives None.


--------------------------------------------------------------------------------------------------------------------------------------
conString = "DRIVER={SQL
Server};SERVER=VIGIL\MSQLINST;UID=sa;PWD=mkdbd;DATABASE=Common"
try:
    con = odbc.odbc(conString)
except:
    mesg = "Unable to establish connection to Common Database"
    print mesg
cur = con.cursor()

#Get Additional Installed Updates from CSDB PatchInfo table
additionalUpdates = list()
query = "select AdditionalPatches from UpdateInfo clientid = '%s' " %
str(5))
print query
try:
    cur.execute(query)
except:
    mesg = "Error:Unable to execute %s query" % (query)
    print mesg
rows = cur.fetchall()
for row in rows:
    upds = row[0]
    print upds
    if upds != "None":
        updsLets = string.split(upds,',')
        for upd in updsLets:
            if not upd in additionalUpdates:
                additionalUpdates.append(upd)
con.close()

-----------------------------------------------------------------------------------------------------------------

Can some help on this?

Thanks
Siddhartha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20101013/8bc6eaeb/attachment.html>


More information about the python-win32 mailing list