Welcome 微信登录

首页 / 数据库 / MySQL / MySQL快速插入大批量数据存储过程

MySQL快速插入大批量数据存储过程
  1. -- ---------------------------- 
  2. -- Table structure for `test` 
  3. -- ---------------------------- 
  4. DROP TABLE IF EXISTS `test`; 
  5. CREATE TABLE `test` ( 
  6.   `id` int(11) NOT NULL AUTO_INCREMENT, 
  7.   `ordernum` varchar(255) NOT NULL, 
  8.   PRIMARY KEY (`id`) 
  9. ) ENGINE=InnoDB AUTO_INCREMENT=500001 DEFAULT CHARSET=utf8; 
  10.  
  11.  
  12. begin 
  13. set @beginnum=1; 
  14. set @endnum=500001; 
  15.  
  16. start transaction; 
  17. while @beginnum < @endnum do 
  18.  
  19. set @v_beginnum=LPAD(@beginnum,7,0); 
  20. set @order=concat(20121105,@v_beginnum); 
  21.  
  22. INSERT INTO test ( ordernum ) 
  23. VALUES 
  24.     ( 
  25.         @order 
  26.     ); 
  27.  
  28.     set @beginnum=@beginnum+1; 
  29.  end while; 
  30.  commit; 
  31.  end 
MySQL使用connector C/C+读取二进制字段Oracle 11g 监听文件日志过大 造成客户端无法连接相关资讯      MySQL数据库教程 
  • MySQL 处理非法数据  (04/09/2013 08:06:28)
  • MySQL关于timestamp和mysqldump的  (12/16/2012 13:25:41)
  • MySQL保证数据完整性  (12/16/2012 12:00:35)
  • ERROR 1130: mysql 1130连接错误的  (12/16/2012 13:29:08)
  • MySQL数据库教程:管理数据库和表(  (12/16/2012 12:47:02)
  • MySQL使用connector C/C+读取二进  (11/05/2012 18:59:59)
本文评论 查看全部评论 (0)
表情: 姓名: 字数
<