MySql循环插入数据(定义了存储过程)
MySQL一窍不通啊,今天工作上需要用到,请教了别人,做以备忘
DROP PROCEDURE test_insert ; DELIMITER ;; CREATE PROCEDURE test_insert () BEGIN DECLARE i INT DEFAULT 0; WHILE i<10 DO INSERT INTO CMS.CMS_Module ( ModuleType, ModuleName, ModuleDescription, DesignHTML, QUERY ) VALUES ( '2', CONCAT('活动',i), '测试加入', 'aaaaaaaaaa', '' ); SET i=i+1; END WHILE ; END;; CALL test_insert();