db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Leroux <s...@wanadoo.fr>
Subject Re: Urgent:Help Needed to copy table data
Date Wed, 28 Oct 2009 10:58:20 GMT
Hi,

Bad news: there's a current (as of version 10.5) limitation of CREATE ... SELECT 
in Derby that only allows one to create the /structure/ of the table, but not to 
insert the data in the same statement:
CREATE TABLE abc AS SELECT * FROM bcd WITH NO DATA
                                       ^^^^^^^^^^^^
(the WHERE clause is useless since we are not copying any row)


Good news: there is an INSERT ... SELECT statement that does the job
INSERT INTO abc SELECT * FROM bcd WHERE NAME='ABC'


As a conclusion, you will need both statements.

Ref:
http://db.apache.org/derby/docs/10.5/ref/rrefsqlj24513.html
http://db.apache.org/derby/docs/10.5/ref/rrefsqlj40774.html


I hope this helps,
Sylvain

MilindK007 a écrit :
> 
> Hi guys can any one please help me for modifying below mentioned sql script
> so that i can run it in derby database.
> create table abc as select * from bcd where name='ABC'
> Please help...


-- 
sylvain@chicoree.fr
http://www.chicoree.fr



Mime
View raw message