CREATE TABLE detailss( id char(50) primary key not null, name varchar(50) )ENGINE=MyISAM DEFAULT CHARSET=utf8; drop procedure p1; delimiter // create procedure p1(in i_before char(20)) begin declare v_str char(50); declare i_times int(10); set i_times=1; while i_times <= 1000 do set v_str = concat(i_before,( right(concat('0000',i_times),4) ) ); insert into detailss(id) values(v_str); set i_times=i_times+1; end while; end// delimiter ; call p1('0010111111');