mySQL alter table on update, current timestamp

mysql, timestamp

Solution

After `MODIFY COLUMN col_name` the syntax requires a `column_definition` which in turn requires a type. Add the current type of this column (e.g. `DATETIME`) before `DEFAULT` to resolve the syntax error.

Problem

``` alter table `quote` modify column `timestamp` DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL ``` What's wrong with the above mysql query? I am trying to change my timestamp column to default and update with the current timestamp. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL' at line 1

Original source