default value current date

default value current date

Post by Ander » Sat, 25 Sep 1999 04:00:00



is it possible to create a table where one field is automatically set
to the current date/time of the server, like a default value ?

would like to have a table for logging information where I don't write
the two first columns: an autoincremental col(PK) and a timestamp.

TIA/anders

 
 
 

default value current date

Post by Mladen Tur » Sat, 25 Sep 1999 04:00:00



Quote:> is it possible to create a table where one field is automatically set
> to the current date/time of the server, like a default value ?

> would like to have a table for logging information where I don't write
> the two first columns: an autoincremental col(PK) and a timestamp.

> TIA/anders

Anders,
Simply create the datetime column with the default value CURRENT_TIMESTAMP,
and the column with the uniqueidentifier.

 
 
 

default value current date

Post by Ander » Sat, 25 Sep 1999 04:00:00


thanks!!

Fri, 24 Sep 1999 18:10:58 +0200, "Mladen Turk"

;CURRENT_TIMESTAMP

 
 
 

default value current date

Post by Tibor Karasz » Tue, 28 Sep 1999 04:00:00


Anders,

Most people prefer to use the IDENTITY property instead of the
uniqueidentifier datatype.

--
Tibor Karaszi
MCDBA, MCSE, MCSD, MCT, SQL Server MVP
Cornerstone Sweden AB
Please reply to the newsgroup only, not by email.


Quote:> is it possible to create a table where one field is automatically set
> to the current date/time of the server, like a default value ?

> would like to have a table for logging information where I don't write
> the two first columns: an autoincremental col(PK) and a timestamp.

> TIA/anders