Re: Is "From" a legal col name.



aaronfude@xxxxxxxxx wrote on 17.04.2006 03:54:
Hi,

This is not really a java question, but java is my platform so I'm
here.

Is "From" a legal column name? Doesn't seem so... I get a syntax error
exception. But I've inherited a database with a From column. What can I
do?

FROM is a reserved word in SQL. According to the standard, if you use a reserved word as an identifier (be it a table or a column) you have to quote it with double quotes:

SELECT "FROM" FROM the_table;

Note that most DBMS are case-sensitiv when using double quotes (I think this is also part of the ANSI definition), so maybe in your case it should read:

SELECT "From" FROM the_table;

Thomas
.



Relevant Pages

  • Re: Dlookup and update not working correctly
    ... resources you would recommend for figuring out this kind of syntax? ... You need to put the variable outside the quotes. ... reserved word and will be confused with the VBA function. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Functions with Dlookup?
    ... Is VanID a text ... you need quotes around the value). ... BTW, Date is a bad choice for a field name: it's a reserved word, and using ...
    (microsoft.public.access.gettingstarted)
  • Re: Making use of a Passed Argument
    ... you are passing it the literal string "ServiceN". ... quotes, it will pass the value of the variable. ... You shouldn't name any of your fields or any other object with a reserved word. ...
    (microsoft.public.access.formscoding)
  • Re: Date format to display month name
    ... just put full quotes around the ... (a Reserved word) ... except in your labels and captions ...
    (microsoft.public.access.queries)