首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

MySQL高速插入大批量数据存储过程

2012-11-23 
MySQL快速插入大批量数据存储过程-- ------------------------------ Table structure for `test`-- -----

MySQL快速插入大批量数据存储过程

-- ------------------------------ Table structure for `test`-- ----------------------------DROP TABLE IF EXISTS `test`;CREATE TABLE `test` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `ordernum` varchar(255) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=500001 DEFAULT CHARSET=utf8;beginset @beginnum=1;set @endnum=500001;start transaction;while @beginnum < @endnum doset @v_beginnum=LPAD(@beginnum,7,0);set @order=concat(20121105,@v_beginnum);INSERT INTO test ( ordernum )VALUES(@order);set @beginnum=@beginnum+1; end while; commit; end


热点排行