Article View: borland.public.vdbase.data.sql
Article #480Re: Field name is a SQL keyword
From: Steve Koterski
Date: Sat, 05 Dec 1998 00:00
Date: Sat, 05 Dec 1998 00:00
32 lines
2037 bytes
2037 bytes
On Fri, 04 Dec 1998 15:39:03 -0800, thall <thall@deltanet.com> wrote:
>I have an table from a legacy system where one of the field names is
>DESC, which is short for description. When I try to use this field in a
>select statement I receive an error, "invalid use of keyword." Is there
>some way to get the system to view this as a field name in a sql
>statement and not a keyword?
>
>Example: select partno, desc, onhand from partfile
To reference that column in an SQL statement, you would need to do two
things to accommodate the local SQL language parser. First, enclose the
column name in quotation marks. Second, prefix that with the table's name
or a table correlation name. Any of the three statements below would be
acceptable.
SELECT PartFile.PartNo, PartFile."Desc", PartFile.OnHand
FROM PartFile
SELECT "PartFile.dbf".PartNo, "PartFile.dbf"."Desc",
"PartFile.dbf".OnHand
FROM "PartFile.dbf"
SELECT P.PartNo, P."Desc", P.OnHand
FROM PartFile P
//////////////////////////////////////////////////////////////////////////
Steve Koterski "What is success in this world? I would say
Technical Publications it consists of four simple things: to live
INPRISE Corporation a lot, to love a lot, to laugh a lot, and
http://www.inprise.com/delphi from it all, to learn a lot."
-- Richard J. Needham
Technical Details
Message-ID:
<366a8eae.32784166@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36687297.506F7EDD@deltanet.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,263bb4574f8d2dfc X-Google-Attributes: gidff5a1,public From: skoterski@NOSPAMinprise.com (Steve Koterski) Subject: Re: Field name is a SQL keyword Date: 1998/12/05 Message-ID: <366a8eae.32784166@forums.inprise.com> X-Deja-AN: 418814704 Content-Transfer-Encoding: 7bit References: <36687297.506F7EDD@deltanet.com> Content-Type: text/plain; charset=us-ascii Organization: INPRISE Corporation, Technical Publications Mime-Version: 1.0 Reply-To: skoterski@NOSPAMinprise.com Newsgroups: borland.public.vdbase.data.sql