Re: Column names have spaces in them!!!



You need to pass the quotes to the SQL engine. And by the way, you should either use parameters or the quote function for values:

my $sth=$dbh->prepare('select * from taskhours_per_date where "employee name"=?');
$sth->execute('NAME HERE');


Maybe MS Acesss has other ways to do this, especially old Access versions have some very strange behaviours.

Alexander

Robert Hicks wrote:

I am using the ODBC module to talk to an Access database. In that database some of the column names have spaces in them (something like EMPLOYEE NAME).

I have tried a bunch of stuff (backticking, brackets, braces, variables) but I cannot seem to do a select on that table.

my $sth = $dbh->prepare("SELECT * FROM taskhours_per_date WHERE `EMPLOYEE NAME` = 'NAME HERE'" );

How do I use a column name with spaces in it?!

I cannot change the table name itself.

Robert



-- Alexander Foken mailto:alexander@xxxxxxxx http://www.foken.de/alexander/

.