|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
is there a way to set the default for a column to be the current date, without making that column a timestamp? i'm trying to provide the current date as the starting point for a column that will ultimately be changed. it seems that if mysql would accept multiple select statements, i should be able to do it with the following syntax:
ALTER table paintings ALTER column creation_date SET DEFAULT (select current_date()); any suggestions? |
|
#2
|
|||
|
|||
|
Use the now() function as your default:
ALTER TABLE paintings CHANGE creation_date creation_date DATETIME DEFAULT 'now()' not null'; now() gives the current date & time. [This message has been edited by netman (edited 09-13-99).] |
|
#3
|
|||
|
|||
|
that SQL statement doesn't work - it produces a default of 0000-00-00 00:00:00
|
|
#4
|
|||
|
|||
|
Sorry... I tested this out with phpMyAdmin and phpMyAdmin automatically defaults the date to the current date.
Sorry. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > set DEFAULT to current date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|