[freetds] freetds silently truncating text/varchar/etc fields to 80 characters

Robert Jay bryopsis at gmail.com
Wed Apr 22 18:38:45 EDT 2009


Hi,

Using freetds v0.83.dev.20090421 (threadsafe, default tds version=5.0)
connecting to a SQL2005 server i found that all of my text fields in INSERTs
were being truncated to 80 characters.

This is using Perl 5.10, and DBD::Sybase.

I managed to fix the problem (well at least bandaid it) by changing line 792
of src/tds/query.c from:

strcat(declaration, "varchar(80)");

to

strcat(declaration, "varchar(255)");


I don't know why it is not building the declaration properly, but could this
be changed to 255 instead of 80?  It's a bit more of a sensible number.  And
maybe a warning logged? Or an entry in the FAQ?

Thanks,
Rob.



More information about the FreeTDS mailing list