I\'m trying to create a table with a name based on the current year and month(2011-09), but MySQL doesn\'t seem to like this.
2011-09
SET @yyyy_mm=Year(
You should be able to do something like this:
SET @yyyy_mm=DATE_FORMAT(now(),'%Y-%m'); SET @c = CONCAT('CREATE TABLE `survey`.`',@yyyy_mm, '` LIKE `survey`.`interim`'); PREPARE stmt from @c; EXECUTE stmt; DEALLOCATE PREPARE stmt;