469,923 Members | 1,203 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

DBI ODBC

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

Jul 19 '05 #1
1 3815
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

"Michael" <mp*********@yahoo.ca> wrote in message
news:vGDKb.983972$9l5.525755@pd7tw2no...
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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Marco Aschwanden | last post: by
4 posts views Thread by Andreas Lauffer | last post: by
3 posts views Thread by Lauren Quantrell | last post: by
5 posts views Thread by Alec | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.