|
Posted by Ben Morrow on May 8, 2008, 12:48 pm
Please log in for more thread options
Quoth ambarish.mitra@gmail.com:
> Hi all,
>
> Using the DBI module, I have connected to a CSV file, and am trying to
> execute SQL queries on the CSV file. I am stuck when there is a space
> in the field name and I cannot proceed.
>
> The CSV file col heading:
> "Attribute","Display Name","Semantic Type","Display Type". (ie, space
> in the heading)
>
> I am trying to "prepare" only those lines for which 'Display Type' is
> given.
>
> The error line is given:
>
> my $sth = $dbh->prepare("select * from report where [Display Type]
> =MultiLineText");
>
>
> SQL ERROR: Bad table or column name '[Display Type]' has chars not
> alphanumeric or underscore!
> SQL ERROR: Couldn't find predicate!
Assuming you are using DBD::CSV, the docs point you to SQL::Statement,
which says you should quote identifiers with double quotes. Quoting with
square brackets is (IIRC) an MS Access-specific syntax. So try
my $sth = $dbh->prepare(
'select * from report where "Display Type"=MultiLineText'
);
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
|