Timestamp field

Der MySQL Datenbank-Server für Internet- und Intranet-Lösungen.

Timestamp field

Beitragvon Alex Kovky » Sa 21 Sep, 2002 19:05

Hi,

Is it possible to create table with timestamp field that will be automatically filled with current date and time after INSERT command ? For example, Microsoft SQL Server has special syntax as follows:

CREATE TABLE [dbo].[traffic] (
[timestamp] [datetime] NULL DEFAULT CURRENT_TIMESTAMP,
[proto] [smallint] NULL
) ON [PRIMARY]
GO

Is it possible for MySQL database?

Yours sincerely,
Alex Kovky
Alex Kovky
 

RE: Timestamp field

Beitragvon mad » So 22 Sep, 2002 16:33

<HTML>... don't know wether there is something like "current_timestamp" in mysql or not,
but at insertion-time you will get similar results with

insert into db values(now(),'otherstuff');

hth,
mad.
</HTML>
mad
 


ZurĂĽck zu MySQL

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 13 Gäste