Time Stamp auto Field

Started by deepak palover 19 years ago3 messagesgeneral
Jump to latest
#1deepak pal
deepak.05pal@gmail.com

hi can we make a field auto incrementing field using Time Stamp data type

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: deepak pal (#1)
Re: Time Stamp auto Field

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

#3Bruno Wolff III
bruno@wolff.to
In reply to: deepak pal (#1)
Re: Time Stamp auto Field

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.