Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defaulting a date column without using timestamp 1

Status
Not open for further replies.

cDevX99

Programmer
Aug 29, 2001
39
US
Is there a way to have a date type column default to the current date without using time stamp. The reason is that I want to store the creation date of a record, but I do not want that date to change on subsequent updates. I have tried to do this using both CURRENT_DATE and curdate() to no avail.
 
when the record is created use the NOW()
ie.
INSERT INTO table_name (col1,col2,create_date)
VALUES ('val1','val2',NOW())

then when u modify the record, just don't modify the date col.

cheers
devnull22

--
Apparently if you play the Windows NT CD backwards you hear satanic messages. If you think that's bad, play it forwards and it installs Windows NT !
 
Thanks, I ended up doing something very similar to that, can it really be possible that there is no way to make the current date the default for a date col in MySQL??? It seems to be the case. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top