I’d like to add a column to existing table in MySQL with name = the day the addition is performed. And I’d like this to happen within the database(i.e. without php,python,perl scripts)
I tried this :
SET @tmp_date = CURDATE();
ALTER TABLE my_report ADD @tmp_date INT(6);
But query fails with error #1064 – You have an error in your SQL syntax;
It’s not the date format because @tmp_date would return 2011-06-03 and
ALTER TABLE my_report ADD `2011-06-03` INT(6);
executes ok
1 Answer