在mysql中实现将当前的时间作为建表时的表名
SET @sqlstr = ConCAT('create table TABLE_',DATE_FORMAT(CURDATE(),'%Y%m%d'),' (id int)');PREPARE stmt1 FROM @sqlstr ;EXECUTE stmt1 ;
例如:备份
SET @sqlstr = ConCAT(' CREATE TABLE sys_log',DATE_FORMAT(now(),'%Y%m') ,' AS SELECT * FROM sys_log ');PREPARE stmt1 FROM @sqlstr ;EXECUTE stmt1 ;