db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajesh Kartha <kar...@Source-Zone.Org>
Subject Re: insert timestamp upon insert?
Date Thu, 01 Dec 2005 06:38:54 GMT
Hi,

Derby supports:

CURRENT DATE - 
http://db.apache.org/derby/docs/10.0/manuals/reference/sqlj69.html
CURRENT TIME - 
http://db.apache.org/derby/docs/10.0/manuals/reference/sqlj73.html
CURRENT TIMESTAMP - 
http://db.apache.org/derby/docs/10.0/manuals/reference/sqlj75.html


Example:

ij> create table t(td date, ts timestamp);
0 rows inserted/updated/deleted
ij> insert into t values (current date, current timestamp);
1 row inserted/updated/deleted
ij> insert into t values(current_date, current_timestamp);
1 row inserted/updated/deleted

For more info please refer the Derby Reference manual at:  
http://db.apache.org/derby/manuals/index.html

-Rajesh

Michael McCutcheon wrote:

> Suppose I have a table like this:
>
> CREATE TABLE discussion_thread
> (
>    discussion_thread_id   INTEGER     NOT NULL GENERATED ALWAYS AS 
> IDENTITY (START WITH 1, INCREMENT BY 1),
>    title                  VARCHAR(50) NOT NULL,
>    creation_date          TIMESTAMP   NOT NULL,
>    creator_user_id        VARCHAR(32) NOT NULL
> );
>
> Is there a way to have derby automatically populate the creation_date 
> column with the current date/time upon insert?
>
> Mike
>



Mime
View raw message