Обсуждение: Auto Insert date/time
What 'serial' does for auto incrementation of intgers, are there something similar in PSQL where the db can autoinsert the correct date/time data each time you add a new row , without have to specify the code e.g. Date() class in a java/C++ file? If well, how do I manage to make this work? Is there maybe an PSQL function which can do it? AN example will be nice :) Big Thanks Smith __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/
On Sun, Apr 07, 2002 at 11:06:54PM -0700, impala wrote: > What 'serial' does for auto incrementation of intgers, > are there something similar in PSQL where the db can > autoinsert the correct date/time data each time you > add a new row , without have to specify the code e.g. > Date() class in a java/C++ file? If well, how do I > manage to make this work? Is there maybe an PSQL > function which can do it? AN example will be nice :) At a guess, you would set the default value of the column to now(). I beleive this is in the docs somewhere... HTH, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Ignorance continues to thrive when intelligent people choose to do > nothing. Speaking out against censorship and ignorance is the imperative > of all intelligent people.
Hi,
something like "INSERT INTO mytable (row1,row2,rowdate) VALUES
('value1','value2',CURRENT_TIMESTAMP)" does that work for me.
The function CURRENT_TIMESTAMP gives exactly, what it´s name says: The
actual timestamp at the time of executing the query.
mfg Frank.
On 08-Apr-02 impala sat down, thought for a long time and then wrote:
> What 'serial' does for auto incrementation of intgers,
> are there something similar in PSQL where the db can
> autoinsert the correct date/time data each time you
> add a new row , without have to specify the code e.g.
> Date() class in a java/C++ file? If well, how do I
> manage to make this work? Is there maybe an PSQL
> function which can do it? AN example will be nice :)
>
> Big Thanks
> Smith
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
--
Frank Finner
Thus we are all responsible for one another, through all the myriad
dimensions of time and space that make up the multiverse . . .
(M. Moorcock, "The Revenge Of The Rose")