On Mon, Aug 17, 2015 at 5:02 PM, Wm Mussatto <mussa...@csz.com> wrote:

> On Mon, August 17, 2015 14:42, tim.bu...@pobox.com wrote:
> > ----- Forwarded message from "Adkins, Blake" <blake.adk...@intel.com>
> > -----
> >
> > Date: Mon, 17 Aug 2015 17:51:41 +0000
> > From: "Adkins, Blake" <blake.adk...@intel.com>
> > To: "tim.bu...@pobox.com" <tim.bu...@pobox.com>
>
> >
> ​[…]​
> Of the 140 columns in the
> >    database, one is named DESC, short for description.
> ​[…]​
> If I try to do a SELECT
> >    using that column, the script dies, or quietly passes DESC in the
> > column header and all the rows. I've
> >    tried to figure out how to get around it without success. Do you have
> > any suggestions aside from
> >    renaming the column? (I was thinking along  the lines of escaping the
> > name)
>
> Put back tick (i.e., `) around DESC.  `DESC`
> DESC is a reserved word and this will tell mySQL that its a Column name
> NOT the reserved word.
>

​Using back-ticks only works if the DBMS is MySQL.​


​Standard SQL uses double quotes around delimited identifiers.  MS SQL
Server uses square brackets.  Other systems have other techniques.
(Informix mostly manages to treat keywords that appear in the context of an
identifier as an identifier instead of a keyword.)
​

-- 
Jonathan Leffler <jonathan.leff...@gmail.com>  #include <disclaimer.h>
Guardian of DBD::Informix - v2013.0521 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."

Reply via email to