MySql循环插入数据
时间:2010-10-11 来源:双击
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();
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();
相关阅读 更多 +