[freetds] String or binary data would be truncated

Robert Dobbs bobisdobbs at hotmail.com
Wed Sep 20 13:53:34 EDT 2006

> > >From a Linux box, I am able to do the $hDatabase->do("UPDATE .....
> >but the 	$hStatement->execute() gives me error
> >DBD::ODBC::st execute failed: [unixODBC][FreeTDS][SQL Server] String or
> >binary data would be truncated. (SQL-22001)
> >
> >and the script quits.
>It means the input exceeds the maximum length of the field definition, i.e. 
>the field is VARCHAR(50) but your input is 52 characters.

>  Thanks for the quick response Mark. However, the same script has been 
>working from a windows box, except that the DBD::ODBC module used is of 
>Windows version.

Sure, but that is still the problem.  DBD::ODBC does not care and probably 
lets your database truncate the value, without interfering with its 
behavior.  DBD::Sybase breaks.  I found that using FreeTDS with DBD::ODBC 
works more like how I expected DBI to work.


Express yourself - download free Windows Live Messenger themes! 

More information about the FreeTDS mailing list