Re: Help on some SQL command...

From: Guo Bin <guobin_(at)yahoo(dot)com>
To: Ang Sei Heng <joanna(at)leopard(dot)cybersource(dot)com(dot)sg>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Help on some SQL command...
Date: 2000-08-17 08:59:17
Message-ID: 20000817085917.12557.qmail@web204.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

You can specify a default value for the create_date
column like:
create_date timestamp default 'now'

In the insert statement just ommit that field and you
will get the default, as
insert into test1 (id, name) values (1, 'xxx');

Regards,
--
Guo Bin

--- Ang Sei Heng <joanna(at)leopard(dot)cybersource(dot)com(dot)sg> wrote:
> Hello to all the SQL gurus...
>
> I have this little table:
>
> test1 (
> id char(8) primary key,
> name char(20),
> create_date timestamp
> );
>
> Now, the create_date need to be updated
> to date and time whenever id is being
> inserted or updated.
>
> Is there a way in SQL that I can do this
> automatically?

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Browse pgsql-sql by date

  From Date Subject
Next Message Maarten Boekhold 2000-08-17 11:55:19 Re: car mileage summation / sledgehammer method
Previous Message Jerome Raupach 2000-08-17 08:45:37 optimization in C