第一种方法:sql存储过程
delimiter //
CREATE PROCEDURE BatchInsertCustomer(IN start INT,IN loop_time INT)
BEGIN
DECLARE Var INT;
DECLARE id INT;
SET Var = 0;
SET id= start;
WHILE Var < loop_time DO
insert into base_patient_copy2(id,user_id,........,tag,descri)
values (CONCAT('LQ',id), '2c9180887398936c0173911111111', NULL, NULL, .........., '1', NULL, '');
SET Var = Var + 1;
SET id= id + 1;
END WHILE;
END;
//
delimiter ;
call BatchInsertCustomer(1,1000000)
---第二种方式:蠕虫,指数增长
重新复制一个表,清空数据,右键--设计表,主键id设置未int,勾选--自动递增
----第一次,重原表copy部分数据
INSERT into base_patient_copy1(user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri) SELECT user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri from base_patient;
----第n次执行蠕动
SELECT count(1) from base_patient_copy1;
INSERT into base_patient_copy1(user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri) SELECT user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri from base_patient_copy1;
再讲主键改回char即可