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

Hi, I'm using the code, listed below, to access information from a Access database. It worked fine when the I had a text field that was limited to 50 characters, but I have since changed this column to be a memo field which holds unlimited characters. When I run the same script I get the following error message;
Fri Jul 27 10:04:15 2001 err, DBD::ODBC::st fetchrow_arrayref failed: Microsoft
ODBC Microsoft Access DriverString data, right truncated on column number 6 (
free_text) (SQL-01004)(DBD: st_fetch/SQLFetch (long truncated) err=1)
Does anyone know why I'm getting this and why is it trying to truncate the data? Many Thanks Chris Heres the code;
$sth = $dbh->prepare("select * from tasks where task_id = $id") or &dienice ("AssignProblem:Can't prepare to get problem report: " . $dbh- +>errstr ); $sth->execute or &dienice ("AssignProblem:Can't get problem report $id: " . $dbh +->errstr); while (@rows = $sth->fetchrow_array) { push(@task, @rows);

Replies are listed 'Best First'.
Re: Failure to get a memo field from a database
by MZSanford (Curate) on Jul 27, 2001 at 13:31 UTC
    This has to do with an ODBC default length. Check the data here. This will suggest something like the following be used :
    # ... $dbh->{LongReadLen} = 20000; $sth = $dbh->prepare("select long_col from big_table"); $sth->execute; # ...

    Thus spake the Master Programmer:
    "When you have learned to snatch the error code from the trap frame, it will be time for you to leave."
    -- The Tao of Programming
      Thanks, that worked great. Chris
      Wow that worked great. Thanks for the post (about six months later!). =) Andrew