Mysql using a stored procedure, you insert a batch of data, you can insert thousands of data, as long as you use the loop statement, it is OK.
mysql ( 5.0 above) in sqlyog Span style= "line-height:33px;font-family: Song Body; font-size:19px" (Version is 8.32 " How to establish a stored procedure:
1,           open sqlyog tools.
2,&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; build table < Span style= "Font-family:times New Roman" >procedurehuihui
CREATE TABLE ' Procedurehuihui ' (
' ID ' BIGINT (a) not NULL auto_increment,
' Code ' VARCHAR DEFAULT NULL,
' Name ' VARCHAR (DEFAULT NULL),
' Dates ' DATE DEFAULT NULL,
PRIMARY KEY (' id ')
) Engine=innodb auto_increment=45 DEFAULT Charset=utf8
3, in theSQLyogin the tool " other " Stored Procedures " create a stored procedure
then write the code for the stored procedure inside, where the stored procedure name is CCEE,
galanzkt is the database name, as follows:
DELIMITER $$
CREATE
/*[definer = {User | Current_User}]*/
PROCEDURE ' galanzkt '. ' CCee ' ()
/*language SQL
| [NOT] Deterministic
| {CONTAINS SQL | NO SQL | READS SQL DATA | Modifies SQL DATA}
| SQL SECURITY {definer | INVOKER}
| COMMENT ' String ' */
BEGIN
DECLARE i INT DEFAULT 0;
While I <
INSERT into Procedurehuihui (code,name,dates)
VALUES (' 001 ', ' Xiao Wang ', ' 2011-07-15 ');
SET i = i + 1;
END while;
end$$
DELIMITER;
--------------------------------------------------------------------------------------
The above blue fonts are written on the system by default, we just need to add the things we want to do, such as the Red Font section.
4,&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; again in the normal < Span style= "Font-family:times New Roman" >query inside call stored procedure, for example:
-- call a stored procedure
Call CCEE ();
Insert the data you want to insert successfully.
MySQL stored procedure inserts a batch of data or thousands of data MySQL loop statements at a time