Re: Is "From" a legal col name.



aaronfude@xxxxxxxxx wrote:
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?

Thanks!

Aaron Fude


It depends - mostly on database vendor. For example in DB2 it is OK to:

D:\Working>db2 create table table (select char(1), from char(1))
DB20000I The SQL command completed successfully.

D:\Working>db2 insert into table values('S','F')
DB20000I The SQL command completed successfully.
D:\Working>db2 select select,from from table table

SELECT FROM
------ ----
S F

1 record(s) selected.


Question is whether "From" column name is stored in your catalog as Uppercase F followed by lowercase r o m. If so - try quoting exactly like it is spelled:

select "From" from ....

as suggested before.

Jan M. Nelken
.