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

James K. Lowden jklowden at freetds.org
Wed Sep 27 23:19:04 EDT 2006


Peter Matulis wrote:
> 
> 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 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:

Ah, I suspected as much.  If you don't get a response from Michael
Peppler, you might want to notify him.  Perhaps DBD::Sybase has an issue
with BIGINT?  

Meanwhile, I encourage you to reconsider your database schema choice. 
It's an old rule in databases: choose numeric types only to store numbers:
quantities, amounts, sizes, etc.  Things you intend to add up or otherwise
treat as numbers.  Otherwise, you get burned when your number-provider
decides letters are OK, or when the leading zero is significant.  Or
something else I can't remember off the top of my head.  

Besides, telephone numbers aren't numeric.  I know, you don't expect to
store 1-800-MATTRESS or Pennsylvania-6-5000, but don't you think you
should be able to?  

BIGINT is 8 bytes; North American phone numbers are 10.  Spoil yourself
and don't spare the bytes, that's what I'd say.  

HTH and regards, 

--jkl





More information about the FreeTDS mailing list