MySql批量生成数据(循环插入)

来源:互联网 发布:韩国女团饭拍软件 编辑:程序博客网 时间:2024/06/05 15:40


[sql] view plain copy
  1. <span style="font-size:18px;">DROP PROCEDURE if exists test_insert ;  
  2.   
  3. DELIMITER ;;  
  4. CREATE PROCEDURE test_insert ()  
  5. BEGIN  
  6.   
  7. DECLARE i INT DEFAULT 1;# can not be 0  
  8.   
  9. WHILE i<1000  
  10. DO  
  11. insert into SS_BOOK values (i, CONCAT("00000",i) , CONCAT('book',i), 1, CONCAT('book_description',i));  
  12. SET i=i+1;  
  13. END WHILE ;  
  14. commit;  
  15.   
  16. END;;  
  17.   
  18. CALL test_insert();</span>  
原创粉丝点击