[freetds] "error_handler: Data-conversion resulted in overflow"

Peter Matulis pmatulis at gmail.com
Wed Sep 27 10:20:38 EDT 2006

On 9/26/06, James K. Lowden <jklowden at freetds.org> wrote:
> Peter Matulis wrote:
> > I currently have a Linux system successfully performing SELECT queries
> > on a MS SQL Server 2000 system.  However, I notice that sometimes I
> > get an error:
> >
> > "error_handler: Data-conversion resulted in overflow"
> >
> > I get this when I add a single column to a select statement.  That
> > column has bigint as datatype.
> That would come from src/ctlib/cs.c, line 650.  It's a bit messy: it
> writes to stderr instead of calling the client's error handler.  But it
> gets the point across, I suppose.
> > Does anyone know why this is happening
> > and how I can resolve it?
> I think you're trying to convert a BIGINT to a string (possibly
> implicitly, through binding).  The character buffer is not big enough.
> The conversion function that emits this message returns CS_FAIL.  That
> should be passed back to your application.

Thanks for your reply.  I'm using a very simple Perl script using the
DBI and DBD:Sybase modules.  I'm not a programmer and would really
appreciate detailed guidance on what I should do to fix this.  This is
my script where 'telephone' is the BIGINT:

use DBI;

my $user   = "BLAH";
my $passwd = "BLAH";

my $dbh = DBI->connect("DBI:Sybase:server=BLAH", $user, $passwd,
{PrintError => 0});

$dbh->do("use BLAH");

unless ($dbh) {
    die "Unable for connect to server $DBI::errstr";

my $sqlStatement = "

FROM agents


$sth = $dbh->prepare($sqlStatement);
$rows = $sth->rows;
print "Rows returned: $rows\n";

while (( $agent_id
        ,$country) = $sth->fetchrow_array ) {
        printf("%s, ,%s ,%s ,%s\n",$agent_id,$telephone,$city,$country);


More information about the FreeTDS mailing list