Skip to content

Instantly share code, notes, and snippets.

@dreamlu
Last active July 2, 2019 08:56
Show Gist options
  • Save dreamlu/0f4999b123ea4ccd82e268bb2f8d8ed9 to your computer and use it in GitHub Desktop.
Save dreamlu/0f4999b123ea4ccd82e268bb2f8d8ed9 to your computer and use it in GitHub Desktop.
批量插入百万数据,存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `database`.`name`()
BEGIN
DECLARE pre_name BIGINT;
DECLARE ageVal INT;
DECLARE i INT;
SET pre_name=862362681;
SET ageVal=100;
SET i=1;
WHILE i < 1000000 DO
INSERT shop(name,union_id, open_id) VALUES(CONCAT(pre_name,'@qq.com'),CONCAT(i ,'unionId'),CONCAT(i,'openId'));
SET pre_name=pre_name+100;
SET i=i+1;
END WHILE;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment