[python-sybase] varchar(350) data getting truncated to 255 characters

Python python at venix.com
Sat Sep 23 23:50:54 EST 2006


On Fri, 2006-09-22 at 16:02 -0400, Python wrote:
> I am running Linux (Fedora 3) with
> 	sybase 0.37
> 	freetds 0.63
> to collect data from a remote Microsoft SQL server.  There is at least
> one field that is truncated to 255 characters as I read it:
> 	(curs.fetchone())
> 
> The curs.description shows:
> 	('Features', 1, 0, 255, 0, 0, 1)
> 	('Remarks', 1, 0, 255, 0, 0, 1)
> 
> However, those fields are actually defined as varchar(350).
> 
> Is this a limitation in the modules?  Am I doing something wrong?

I tracked down the issue to freetds.  It limits varchar fields to 255
chars.  The freetds site recommends converting or casting the fields to
text.

http://www.freetds.org/userguide/troubleshooting.htm#KNOWNISSUES
has the details.

> Should I be using a different set of modules to connect a Python program
> to a remote Microsoft SQL server?

-- 
Lloyd Kvam
Venix Corp



More information about the Python-sybase mailing list