Re: Column names have spaces in them!!!
- From: alexander@xxxxxxxx (Alexander Foken)
- Date: Tue, 31 Jan 2006 18:20:18 +0100
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/
.
- References:
- Column names have spaces in them!!!
- From: Robert Hicks
- Column names have spaces in them!!!
- Prev by Date: Re: Column names have spaces in them!!!
- Next by Date: Re: Column names have spaces in them!!!
- Previous by thread: Re: Column names have spaces in them!!!
- Next by thread: Re: Column names have spaces in them!!!
- Index(es):