mysql循环插入分隔符分开的字符串

CREATE DEFINER=`root`@`localhost` PROCEDURE `test`()
BEGIN
DECLARE i,help_topic_id INT;
SET i=10469;
SET help_topic_id=0;
WHILE i<10475
DO
INSERT INTO `login`.t_user_info(`id`, `uid`, `account`, `create_time`, `update_time`) VALUES (i, i, SUBSTRING_INDEX(SUBSTRING_INDEX('yan;huang;zhang;wangzi;',';',help_topic_id+1),';',-1),'2022-02-15 10:08:50', '2022-02-15 10:08:53');
SET i=i+1;
SET help_topic_id=help_topic_id+1;
END WHILE ;
commit;


END

posted @ 2022-09-30 14:57  小堆堆儿  阅读(111)  评论(0编辑  收藏  举报