db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCutcheon <michaelm...@frontiernet.net>
Subject Re: insert timestamp upon insert?
Date Fri, 02 Dec 2005 04:50:15 GMT
Satheesh Bandaram wrote:

> You can also define a default on the timestamp column... Derby allows 
> references to special registers in default clause.
>
> Like: creation_date timestamp not null *default current timestamp*,
>
> Satheesh
>
> Mike Matrigali wrote:
>
>> you probably can use an insert trigger to get the desired result.
>>
>> 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
>>>
>>>
>>>
>>
>>
>>
Thanks...this is just what I was looking for!


Mime
View raw message