Discuss set DEFAULT to current date in the MySQL Help forum on Dev Shed. set DEFAULT to current date MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
Time spent in forums:
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());
Time spent in forums: 14 h 42 m 29 sec
Reputation Power: 36
i believe i am having a similar problem... i need to set my default value to a function as well, but pma seems to have none of this. is there perhaps any way to have it done via the mysql console?
i need to set the default value of a timestamp field to CONVERT_TZ(CURRENT_TIMESTAMP, 'SYSTEM', '+2:00'), the following select statement works in PMA to change the timezone...
SELECT CONVERT_TZ(CURRENT_TIMESTAMP, 'SYSTEM', '+2:00') AS timestamp_SAST;
if i uncheck the timestamp mark, and insert the CONVERT_TZ function as used above into the default field in phpMyAdmin, it sets the default time to 0000-00-00 00:00:00 as yours does... :/ i guess one cannot add functions to default values, yet this page says you can: http://www.modwest.com/help/kb6-256.html
Last edited by buggers : February 12th, 2010 at 10:04 PM.