>>>>>>>>>>>> [EMAIL PROTECTED] wrote (2007-06-06 09:04:30): > Hi > > I have a legacy DB2 table which has a special character like '#' in the > column name like ACCT#. I am using derby for in-memory unit testing. Derby > does not allow me to have a special character like '#' in the column name > in my create table statement. Is there anyway to escape the special > character so that I can have special characters in column names. > I would really appreciate any help in this regard.
No porblem. Just use quotes. E.g.:
ij> create table "ACCT#" ("#1" int);
0 rows inserted/updated/deleted
ij> insert into "ACCT#" values(1),(2);
2 rows inserted/updated/deleted
ij> select * from "ACCT#" where "#1" > 1;
#1
-----------
2
1 row selected
ij>
This behaviour is according to the SQL standard.
>
> Thanks
> Saad Khawaja
> ======================================================================
> Confidentiality Notice: The information contained in and transmitted with
> this communication is strictly confidential, is intended only for the use of
> the intended recipient, and is the property of Countrywide Financial
> Corporation or its affiliates and subsidiaries. If you are not the intended
> recipient, you are hereby notified that any use of the information contained
> in or transmitted with the communication or dissemination, distribution, or
> copying of this communication is strictly prohibited by law. If you have
> received this communication in error, please immediately return this
> communication to the sender and delete the original message and any copy of
> it in your possession.
> ======================================================================
--
Bernt Marius Johnsen, Database Technology Group,
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway
pgpVRSyDeOFZS.pgp
Description: PGP signature
