mysql 循環寫入數據庫


測試過程經常用到插入數據

 

我們首先建一個函數:

delimiter #
create procedure test_double()
begin
declare i int default 0;
declare j int default 1;
declare k int default 1;
while i < 2000 do
insert into cdyy(projectname,projectno,creattime) values (CONCAT('測試預約項目0000',j),CONCAT('2018010100',k),now()); 
set i = i + 1;
set k = k + 1;
set j = j + 1;
end while;
end #

然后再調用這個函數就可以了

call test_double();

  

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM