db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Army <qoz...@sbcglobal.net>
Subject Re: SQL Syntax : INSERT INTO when no columns to specify
Date Tue, 05 Jul 2005 15:50:47 GMT
Andy wrote:
> Hi,
> 
> I couldn't find an answer in the manual so ask here. 
> I have a table (for whatever reason) with just 1 column which is defined as 
> "generated always as identity (start with 1)"
> 
> What is the syntax for an INSERT into such a table?

If I'm understanding the question correctly, you should just use the "DEFAULT" 
keyword to perform the insert:

INSERT INTO tbl VALUES (DEFAULT)

For example,

ij> create table tbl (i int generated always as identity (start with 1));
0 rows inserted/updated/deleted
ij> insert into tbl values (default);
1 row inserted/updated/deleted
ij> select * from tbl;
I
-----------
1

1 row selected

Hope that helps,
Army


Mime
View raw message