in reply to Re: Unable to retrieve field which has more than 255 chars
in thread Unable to retrieve field which has more than 255 chars

This is my code:

my $dbiConn="DBI:Sybase:server=$prop{dbHost}:1433";

my $db=DBI->connect($dbiConn,$prop{dbUser},$prop{dbPwd});

my $sqlSt="select FilesTransfered,transactionDate from CDProcessTransaction where processname = '$prop{process}'";

my $recordSet=$db->prepare($sqlSt);

$recordSet->execute( );

while (my @rValue=$recordSet->fetchrow_array)

{

print OUT "Files: @rValue\n";

}

If length of field "FilesTransfered" is more than 255 characters, its truncated. This field contains the filenames processed (sometimes upto 20 filenames where it exceeds more than 255 chars)

.
  • Comment on Re^2: Unable to retrieve field which has more than 255 chars

Replies are listed 'Best First'.
Re^3: Unable to retrieve field which has more than 255 chars
by choroba (Cardinal) on Mar 07, 2012 at 09:59 UTC
    What is the type of the field? (I.e. show us how the table is created.)
Re^3: Unable to retrieve field which has more than 255 chars
by JavaFan (Canon) on Mar 07, 2012 at 10:20 UTC
    f length of field "FilesTransfered" is more than 255 characters, its truncated.
    Sure, but not on retrieval. It means you're trying to stuff more than 255 characters in a field that doesn't allow more. It's like putting 100 pairs of socks in a drawer that only fits 20. You cannot get more than 20 pairs of socks out of them, the other 80 will have dropped on the ground.

    Change the type of column, and repopulate the table.

    Note that this isn't a Perl issue. It's a database issue, and you'll have this problem regardless of the language you're using to access the database.

Re^3: Unable to retrieve field which has more than 255 chars
by remiah (Hermit) on Mar 07, 2012 at 12:02 UTC

      Thank you remiah... I referred the link and it got fixed.

      I already had entry in freetds.conf file and it had version 8. I simply removed the port=1433 in connection and it worked... ! Baffling, really; how this change had effect in truncation...

      Anyhow, it fixed my issue. Thanks for all your replies