PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: CSane at EvergreenInvestments dot com
Subject: Re: String truncated to 255 chars using DBD::Sybase with MSSQL
Date: May 18 2009 5:27PM


It sounds like you have a ct-lib from version 12.0 or older... Version 12.5 allowed strings longer than 255.



"Ed Avis" <eda@waniasset.com>
Sent by: owner-sybperl-l@peppler.org

05/18/2009 01:06 PM

To
<sybperl-l@peppler.org>
cc
Subject
String truncated to 255 chars using DBD::Sybase with MSSQL





I am using DBD::Sybase on Linux (Fedora 10) to connect to an MSSQL server (Microsoft SQL Server 2000).  The database allows varchar columns greater than 255 characters in length, but when querying from them the result is silently truncated.

   my $long_string = 'x' x 200;
   $dbh->do("select '$long_string' + '$long_string' as x into #t");

   my $sql = 'select len(x) from #t';
   my $got = $dbh->selectall_arrayref($sql)->[0]->[0];
   say $got;

   $sql = 'select x from #t';
   $got = $dbh->selectall_arrayref($sql)->[0]->[0];
   say length $got;

This prints '400' then '255' but I expected '400' and '400', or at least, some exception thrown when the string was too long.

Is there a way to access the whole string using DBD::Sybase?

--
Ed Avis <eda@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________