The Log Information table script is created in MySQL in bulk through stored procedures as follows:
Drop PROCEDURE if EXISTS reqsp;delimiter//create PROCEDURE reqsp (stime varchar (+), etime varchar (+), Tchema varchar (32) ) begindeclare sName varchar (1024);d eclare uid varchar (n);d eclare orderId varchar (+);d eclare sqlvar varchar (+/--); Declare rest int;set rest = 1;while Rest > 0 Do set stime = (select Date_format (select Adddate (stime,1)), '%y%m%d '); Set sName = CONCAT (' tbl_resp_ ', stime); Set uid = CONCAT (' idx_id_resp_ ', stime); Set orderId = CONCAT (' idx_order_resp_ ', stime); Select COUNT (1) from information_schema.tables where table_name = SName and table_schema=tchema into @cnt; If @cnt = 0 Then Set sqlvar=concat (' CREATE table ', SName, ' (ID varchar () is not null, ', ' order varchar ') is not NULL, ', ' ads int ' is not null, ', ' type varchar ' is not NULL, ', ' group Int (ten) not null, ', ' template int (ten) not null, ', ' Banner varchar (+) default null, ', ' app varchar (+) default null, ', ' create_time datetime not NULL, ', ' key ', UID , ' (UID), ', ' key ', OrderId, ' (Order_id) ', ') Engine=myisam DEFAULT Charset=utf8 '), set @v_s =sqlvar;prepare stmt from @v_s; EXECUTE stmt;deallocate PREPARE Stmt;end if; Set rest = DATEDIFF (etime,stime); END while;end;//DELIMITER;
Call REQSP (' 20141001 ', ' 20151001 ', ' dbname ')
First parameter start time 20141001
Second parameter end time 20151001
The third parameter is the database name
Batch create log table information script in MySQL