This stored procedure will insert 10,000 records into the specified table with the given values for each field. To use it, replace '表名' with the name of your table, '字段1' and '字段2' with the names of your fields, and '值1' and '值2' with the values you want to insert. Then, execute the procedure by calling 'call insert_data();' in your SQL client.

delimiter $$ 
create procedure insert_data() 
begin 
declare i int default 0; 
while i<10000 do 
insert into 表名(字段1,字段2) values(值1,值2); 
set i=i+1; 
end while; 
end $$ 

call insert_data();
MySQL Stored Procedure for Bulk Data Insertion

原文地址: https://www.cveoy.top/t/topic/lfol 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录