MySql存储过程批量添加数据
DROP PROCEDURE IF EXISTS PROC_USER_INSERT; delimiter $$ -- 创建存储过程 CREATE PROCEDURE PROC_USER_INSERT( IN START_NUM INT, IN MAX_NUM INT ) BEGIN DECLARE TEMP_NUM INT DEFAULT 0; SET TEMP_NUM=START_NUM; WHILE TEMP_NUM<=MAX_NUM DO INSERT INTO t_user(user_name,account_number,user_pwd) VALUES('XIAOHEMIAO',TEMP_NUM,'123456'); SET TEMP_NUM=TEMP_NUM+1; END WHILE; END$$ ; delimiter; -- 调用存储过程 CALL PROC_USER_INSERT(1,5000); -- 删除存储过程 DROP PROCEDURE PROC_USER_INSERT;
友情链接:
http://www.xiaochenboss.cn/article_detail/1607329835749