Possible Duplicate:
How do you set a default value for a MySQL Datetime column?
I have a table with column CreatedDate of data type datetime and i want to be able to set its default value to current DateTime how do i do it?
I tried Now() and CurrentTimestamp but no luck so far!!!
You can only set a static default in the table definition.
So unless you want to call ALTER TABLE
every minute....
Use a trigger:
DELIMITER $$
CREATE TRIGGER bu_table1_each BEFORE UPDATE ON table1 FOR EACH ROW
BEGIN
SET new.datefield = NOW();
END $$
DELIMITER ;
I do not think you can do it with DateTime.
See: How do you set a default value for a MySQL Datetime column?