create procedure populate_table()
begin declare i int default 0;
while i < 10000
insert into test values (i, 'test', 'test2');
set i = i+1;
Wednesday, July 30, 2008
Quickly Populate a Table
There are a lot of times in MySQL when I want to populate a table with dummy data. I've used scripts to do this on many occasions; however, this stored procedure works just as well. I'm posting it here mainly for my own reference. Obviously the insert and while sentinel need to be modified for your particular uses.