Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Row Creation Date

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-08-21 : 09:08:33
I need a row creation date.

Is it better to simply

INSERT NOW(), ....

or is there a DEFAULT TIMESTAMP / NOW() value that can be designed into the table?

SamC

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-08-21 : 09:15:30
I think it is better to have a field and as you say something like INSERT NOW()

The timestamp datatype does not actually hold creation date information as far as i know.

Paul
Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-08-21 : 10:04:21
you can define a default on the column

 
ALTER TABLE Products
ADD cre_date datetime NOT NULL DEFAULT getdate() WITH VALUES



In TSQL the GETADTE() function is used for the current date and time



HTH
Jasper Smith
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2002-08-22 : 09:54:28
Jasper,

Thanks - this was a help.

It's a nice way to add a create row date to a table without modifying the ASP code that drives it.

SamC

Go to Top of Page
   

- Advertisement -