PaiMei has asked for the wisdom of the Perl Monks concerning the following question:
It should Insert those values at a table called Level, but it wont insert. It says "Execute failed: Syntax error on insert into statement (SQL-42000)" I've checked the table, its fields and values, everything and it should be okay, but its not. And thats why I'm here seeking for help. Someone, please? NOTE: I found the problem. The table name is a SQL Reserved Word. Thank you!for my $i ($new->{'minrow'} .. $new->{'maxrow'}){ for my $j ($new->{'mincol'} .. ($new->{'maxcol'} - 1)){ $cell = $worksheetloop->get_cell($i, 0); $CodColab = $cell->value(); $cell = $worksheetloop->get_cell(1, $j); $CodTecno = $cell->value(); $cell = $worksheetloop->get_cell($i, $j); $cellVal = $cell->value(); if(!defined($cell) or $cell->value() eq ""){ $cellVal = 0; } $sqlCom = "INSERT INTO Level (Codigo, Nivel, DataAval, + CodColab, CodTecno) VALUES (?, ?, ?, ?, ?)"; $sth = $dbh->prepare($sqlCom); $sth->bind_param(1, $counter); $sth->bind_param(2, $cellVal); $sth->bind_param(3, "2014-02-04"); $sth->bind_param(4, $CodColab); $sth->bind_param(5, $CodTecno); print "$sqlCom\n"; getc(); $sth->execute(); $counter++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl, Excel and MS Access Database (SQL-42000)
by jellisii2 (Hermit) on Feb 04, 2014 at 12:52 UTC | |
by PaiMei (Initiate) on Feb 04, 2014 at 13:09 UTC |