Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

MS SQL (DBD::SyBase) varchar limitation

by boo (Scribe)
on Apr 15, 2008 at 15:47 UTC ( [id://680544]=perlquestion: print w/replies, xml ) Need Help??

boo has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks ! I have a problem using DBD::Sybase to access a MSSQL 2000 database... I can't retrive more than 255 chars in varchar fields... Does anybody knows how to fetch more chars ? This isn't a MSSQL 2000 limitation, because I can fetch up to 16k chars using Java or C++. Somebody can bring me some lightening ?

Replies are listed 'Best First'.
Re: MS SQL (DBD::SyBase) varchar limitation
by Arunbear (Prior) on Apr 15, 2008 at 16:02 UTC
    Try setting the LongReadLen attribute to a suitably high value, e.g.
    $dbh->{LongReadLen} = 1000;
Re: MS SQL (DBD::SyBase) varchar limitation
by runrig (Abbot) on Apr 15, 2008 at 18:09 UTC
    The documentation seems to indicate that 255 is all you'll get. Try converting the column to text: select CAST(my_varchar_column as TEXT) ..., (or try DBD::ODBC).
      Didn't work :( I tried DBD::ODBC and didn't work too...
        Define "didn't work". Same truncation at 255 characters, or something else?
Re: MS SQL (DBD::SyBase) varchar limitation
by mpeppler (Vicar) on Apr 16, 2008 at 06:35 UTC
    The 255 char limitation is a protocol level limitation. You need to make sure that you connect to your MS-SQL server with TDS 8 (you set this in the freetds.conf file, IIRC).

    Once that is done then you should be able to retrieve varchar columns wider than 255 (or at least there is no limit in DBD::Sybase that would prevent that.)

    As an aside, LongReadLen has nothing to do with this - that's for BLOB-type columns (in Sybase/MS-SQL parlance that's TEXT and IMAGE data).

    Michael

    PS: keep in mind that I don't use FreeTDS, or MS-SQL at all, so the above is pretty much all I know about the matter...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://680544]
Approved by DaWolf
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-03-29 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found