Обсуждение: Time Stamp auto Field

Поиск
Список
Период
Сортировка

Time Stamp auto Field

От
"deepak pal"
Дата:
hi can we make a field auto incrementing field using Time Stamp data type

Re: Time Stamp auto Field

От
"A. Kretschmer"
Дата:
am  Tue, dem 05.12.2006, um 17:31:53 +0530 mailte deepak pal folgendes:
> hi can we make a field auto incrementing field using Time Stamp data type

On INSERT: set the default value for this field to now()
For Update: create a trigger to do this.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Time Stamp auto Field

От
Bruno Wolff III
Дата:
On Tue, Dec 05, 2006 at 17:31:53 +0530,
  deepak pal <deepak.05pal@gmail.com> wrote:
> hi can we make a field auto incrementing field using Time Stamp data type

You can use a column default that uses current_timestamp for its expression.
If you also want to handle updates or override cases where people supply
values for that column, then you should look at using before triggers.