RobertCraven has asked for the wisdom of the Perl Monks concerning the following question:
I am failing to truncate (or populate later on) a table in a MySQL database using DBI.
my $table = 'modeltargetsHet'; my $sth = $dbh->prepare(q{ truncate ?; }) or die $dbh->errstr; $sth->execute($table) or die $dbh->errstr;
produces this error:
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''modeltargetsHet'' at line 1 at identifyModeltargets.pl line 204.How do I have to pass the table name correctly?
Manual executing the truncate command works fine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI passing tablename
by Anonymous Monk on Jun 11, 2009 at 01:05 UTC | |
|
Re: DBI passing tablename
by afoken (Chancellor) on Jun 11, 2009 at 11:12 UTC | |
by RobertCraven (Sexton) on Jun 11, 2009 at 14:59 UTC |