DBI ODBC

M

Michael

I have a small perl script that inserts data from a tab file to an Access
database.

my $sth = $dbh->prepare(<<SQL);
INSERT INTO Notes ("Account Number", "NUM", "DESC", "UID", "NOTES")
VALUES(?,?,?,?,?)
SQL

$sth->bind_param(1,$rec[0],SQL_VARCHAR);
$sth->bind_param(2,$rec[1],SQL_VARCHAR);
$sth->bind_param(3,$rec[2],SQL_VARCHAR);
$sth->bind_param(4,$rec[3],SQL_VARCHAR);
$sth->bind_param(5,$rec[4],SQL_VARCHAR);

$sth->execute;

....


The script is failing part way through the tab file with the error:

DBD::ODBC::st bind_param failed: [Microsoft][ODBC Microsoft Access
Driver]Invalid precision value ...


Any help or hints about this error would be appreciated...


Michael
 
M

Michael

ok...I figured it out. For those of you interested:
$sth->bind_param(5,$rec[4],SQL_VARCHAR); -> s.b.
$sth->bind_param(5,$rec[4],SQL_LONGVARCHAR);

Access requires the use of SQL_LONGVARCHAR ins this case as the field being
inserted is quite large...


thanks...


Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top