Forums | Webyog
Tools to manage and monitor MySQL databases
forums › forums › SQLyog › Using SQLyog › How Do You Set The Default Vale For A Date Field?
How do you set the default value for a date field in a table to the current date??? I entered curdate() in the Default column when creating the table, but it did now work. The datatype column is set to date.
According to 10.1.4. Data Type Default Values no, you can't do that with date column.
But you can do it with timestamp.
create table test (
id int,
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);