|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
INSERT create date
I found in the forum how to insert the current date into the db, but I'm not sure that answers my question.
When a new record is inserted into the DB I would like mysql to automatically insert the current date which will be the date of creation and never change it again, even when the record is edited etc. Thanks |
|
#2
|
||||
|
||||
|
RE: INSERT create date
If you use a TIMESTAMP column, it will automatically update the value on any INSERT or UPDATE operation. That doesn't really solve your problem though since you only want it to update on INSERT and not on UPDATE. I think you can accomplish that by using two TIMESTAMP columns. Giving them both values of NULL on INSERT should set them both to be the current time, but UPDATEs will only change the first TIMESTAMP column, so the second reamins the same. See http://www.mysql.com/doc/en/DATETIME.html for more.
|
|
#3
|
|||
|
|||
|
RE: INSERT create date
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > INSERT create date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|