db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Eric Miller" <jemil...@uchicago.edu>
Subject Re: Way to quote schema/table names?
Date Thu, 21 Apr 2005 17:49:15 GMT
Thanks.

Jon

----- Original Message ----- 
From: "Jack Klebanoff" <klebanoff-derby@sbcglobal.net>
To: "Derby Discussion" <derby-user@db.apache.org>
Sent: Thursday, April 21, 2005 12:32 PM
Subject: Re: Way to quote schema/table names?


> Jonathan Eric Miller wrote:
>
>> Hi,
>>
>> I'm attempting to create a table which is in a schema named "at." I think 
>> that the string "at" in some contexts is considered a reserved word, so, 
>> it's failing. Does anyone know if there is a way to get this to work? 
>> i.e. a way to quote the schema and table name or something?
>>
>>     [java] create table at.Department (
>>     [java]    id integer not null generated always as identity,
>>     [java]    name varchar(255),
>>     [java]    number varchar(32),
>>     [java]    title varchar(255),
>>     [java]    primary key (id)
>>     [java] )
>>     [java] Apr 20, 2005 4:46:23 PM 
>> org.hibernate.tool.hbm2ddl.SchemaExport execute
>>     [java] SEVERE: Unsuccessful: create table at.Department (id integer 
>> not null generated always as identity, name varchar(255), number 
>> varchar(32), title varchar(255), primary key (id))
>>     [java] Apr 20, 2005 4:46:23 PM 
>> org.hibernate.tool.hbm2ddl.SchemaExport exec
>>     [java] SEVERE: Syntax error: Encountered "at" at line 1, column 14.
>>
>> Jon
>>
>>
>>
> You can quote schema and table names using the standard SQL quoting 
> mechanism: double quotes, '"'. E.g.
>
> create schema "at";
> create table "at".Department( ...);
>
> Note that when you quote a name it becomes case sensitive. So, in the 
> example above
>  select * from "AT".Department;
> will not work, Derby will not find schema "AT", you must use "at" instead.
>
> Jack Klebanoff
> 


Mime
View raw message