MySQL存储过程循环添加数据

经常需要测试数据,写个存储过程方便日后使用。

DROP PROCEDURE IF EXISTS add_member;
DELIMITER $$
CREATE PROCEDURE add_member (IN loop_times INT) 
BEGIN
 DECLARE member_account INT DEFAULT 0;
    WHILE member_account < loop_times DO
    SET member_account = member_account + 1;
        INSERT INTO t_member ( member_name, member_password ) VALUES ( member_account, 'e10adc3949ba59abbe56e057f20f883e' );
    END WHILE;
END $$

CALL add_member (10000000);

 

posted @ 2016-05-06 20:11  Vincent-Li  阅读(1299)  评论(0编辑  收藏  举报