Home > Database > Mysql Tutorial > MySQL快速插入大批量数据存储过程_MySQL

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:38:49
Original
1006 people have browsed it

bitsCN.com


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

 

[html]    

-- ----------------------------  

-- 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;  

  

begin  

set @beginnum=1;  

set @endnum=500001;  

  

start transaction;  

while @beginnum

  

set @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  
 

bitsCN.com
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
test
From 1970-01-01 08:00:00
0
0
0
What does: self/Test mean after the function?
From 1970-01-01 08:00:00
0
0
0
File permission setting test failed
From 1970-01-01 08:00:00
0
0
0
How to stop function execution under test?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template