当前位置:首页>开发>正文

如何使用MySQL实现批量插入数据

2023-06-22 10:29:09 互联网 未知 开发

 如何使用MySQL实现批量插入数据

如何使用MySQL实现批量插入数据

用存储过程,写个循环给你个我以前写的看看
begin
declare i int
declare b int
declare c int
set @i=2
set @b=6
set @c=0
set @stmt = concat(insert into t_j_goods_name (id,`code`,`name`)
values(?,?,(select distinct `a` from sheet1 limit ?, 1)))
while @i<442 do
prepare s1 from @stmt

execute s1 using @b,@i,@c

deallocate prepare s1
set @i=@i 1,@b=@b 1,@c=@c 1

end while
end

最新文章