I am having trouble getting my prepare statement to run in MySQL 5.6.14; here is the block of code in question:
SET @backupDate = DATE(NOW());
SET @renameTable = CONCAT('RENAME TABLE activeDirectoryData TO actDirBackup-', @backupDate);
PREPARE goRenameTable FROM @renameTable;
EXECUTE goRenameTable;
DEALLOCATE PREPARE goRenameTable;
The script stops at the prepare statement, with the following error:
Error Code: 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 '-2013-11-06' at line 1
Any idea what is wrong here?