Chinaunix首页 | 论坛 | 博客
  • 博客访问: 291957
  • 博文数量: 49
  • 博客积分: 4776
  • 博客等级: 中校
  • 技术积分: 486
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-02 10:42
文章分类

全部博文(49)

文章存档

2010年(6)

2009年(8)

2008年(20)

2007年(10)

2006年(2)

2005年(3)

分类: Mysql/postgreSQL

2010-08-26 08:55:55

delimiter // 
drop procedure autoinsert if exist autoinsert //
create procedure autoinsert()   
begin
    declare i int default 1;   
    while (i <= 100000) do   
        insert into test.t_count (a) values(i);   
        set i = i+1;   
    end while;   
end
//
delimiter ;
 
 
CREATE ` PROCEDURE `insert_isam`(p int,t char(10))
begin
set @i = 0;
set @str = “iamauperman!iwillbeahero!!”;
repeat
#select name into @str from mysql.help_topic order by rand() limit 1;
set @str=substr(@str,1,25);
set @ins_str = repeat(@str,floor(rand()*10));
set @cmd=concat(‘insert into ‘,t,’ (content) values(“‘,@ins_str,’”)’);
prepare stmt from @cmd;
execute stmt;
set @i = @i+1;
until @i > p end repeat;
end
阅读(1532) | 评论(2) | 转发(0) |
0

上一篇:Linux Tips

下一篇:没有了

给主人留下些什么吧!~~

网络安全服务2011-08-11 10:54:13

chinaunix网友2010-08-29 15:54:47

Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com