- DROP PROCEDURE dowhile;
- create PROCEDURE dowhile()
- BEGIN
- DECLARE i int DEFAULT 0;
- START TRANSACTION;--定义事务
- WHILE i<100 DO
- INSERT INTO user_basic(username,`password`,location,email,sex,`sign`,headImg,lastLogin,grade,inTime)
- VALUES(CONCAT('username',i),CONCAT('password',i),CONCAT('福田 ',i),CONCAT('username@test',i,'.com'),1,CONCAT('这是测试 ',i),'',now(),10+i,now());
- set i=i+1;
- END WHILE;
- COMMIT;--开始执行事务
- END
mysql循环插入数据
最新推荐文章于 2024-08-13 04:10:37 发布