1.在函数里面新建一个存储过程
CREATE DEFINER=`root`@`%` PROCEDURE `NewProc`()
BEGIN
SET @num = 1;
WHILE
@num < 1000000 DO
你需要插入的sql语句
INSERT INTO attendance_card_record ( id, user_id, attendance_set_id, user_name, image_name, fastdfs_path, suffix, create_time, devisn_type, system_code, campus_id )
VALUES
(
REPLACE ( UUID( ), ‘-‘, ‘‘ ),
‘1077189277‘,
‘1077189277‘,
‘0b496134937342eca15690134142a36a‘,
‘cfd29e8056834f8d90f939354d2d3b4e‘,
‘曾庆会‘,
‘1077189277‘,
‘2019-09-16 08:58:58‘,
‘1077189277‘,
‘4A:BA:72:BD:57:B7‘,
‘2019-09-16 08:58:58‘
);
SET @num = @num + 1;
END WHILE;
END
2.然后调用存储过程
call NewProc()
原文:https://www.cnblogs.com/bt2882/p/11577593.html