Board index » delphi » Table Field name is a SQL Reserved Word !

Table Field name is a SQL Reserved Word !

   I met a problem seems very simple:

   I have a DBF file which on field's name is LENGTH,
when I write a SQL for it such as:

   SELECT
   :
   LENGTH AS LEN,
   :
   FROM
   :
   :

   It report an runtime error like "Error use of  Keyword",
I think it must cased by "LENGTH" as it's reserved word
of SQL.

   So how can I use this field in SQL without additional code?

  Thanks for any respon!

 

Re:Table Field name is a SQL Reserved Word !


Quote
Jeff Ding <toll%sbt...@btmv06.god.bel.alcatel.be> wrote:

>    I met a problem seems very simple:

>    I have a DBF file which on field's name is LENGTH,
> when I write a SQL for it such as:

>    SELECT
>    :
>    LENGTH AS LEN,
>    :
>    FROM
>    :
>    :

>    It report an runtime error like "Error use of  Keyword",
> I think it must cased by "LENGTH" as it's reserved word
> of SQL.

>    So how can I use this field in SQL without additional code?

Quote it, just like you did above.

Jasper

Re:Table Field name is a SQL Reserved Word !


In article <337736D5.D1C38...@btmv06.god.bel.alcatel.be>, Jeff Ding
<toll%sbt...@btmv06.god.bel.alcatel.be> writes

Quote

>   I met a problem seems very simple:

>   I have a DBF file which on field's name is LENGTH,
>when I write a SQL for it such as:

>   SELECT
>   :
>   LENGTH AS LEN,
>   :
>   FROM
>   :
>   :

>   It report an runtime error like "Error use of  Keyword",
>I think it must cased by "LENGTH" as it's reserved word
>of SQL.

>   So how can I use this field in SQL without additional code?

>  Thanks for any respon!

The good news is that it can be done - the bad news is that I cant
remember how!
Perhaps "LENGTH" in quotes, or MyTable.Length?

--
Pete Clark
ElmSoft Ltd
Tel (01253) 22637 - (0973) 333595

Other Threads