mysql批量输入

数据库名为test,内有字段A,B,C,D,批量插入100条数据,字段A为a1、a2、a3....a100,字段B为b1,b2,b3....b100,字段C、D内容不变。

使用循环语句:
create procedure InsertTest()
begin
declare i int;
declare s varchar(20);
set i=1;
while i<=100 do

begin
select s=cast(i AS varchar(20));
insert into test(A,B,C,D) values('a'+s;'b'+s,'ccccc','ddd');
set i=i+1;
end while;
end;

你可能感兴趣的:(mysql批量输入)