I want to set addtime(current_timestamp, '15:00:00')
as the default value of one MySQL table column. I tried to do this with the following command but failed:
mysql> alter table mytable change c1 c2 timestamp null default addtime(current_timestamp, '15:00:00');
ERROR 1064 (42000): 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 'addtime(current_timestamp, '15:00:00')' at line 1
How to do this? Thanks.
Best Answer
Two things
I ran this sample code:
Here is the result:
Give it a Try !!!
Caveat : I tried at least 7 ways to make timestamp work like this. NO GO !!! So, you must use DATETIME.