日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
SQLServer數(shù)據(jù)庫如何使用存儲過程造批量數(shù)據(jù)

我們知道,在SQL Server數(shù)據(jù)庫操作中,有時候需要我們生成大量的數(shù)據(jù),比如說在做性能測試的時候,經(jīng)常會遇到需要大量的數(shù)據(jù)用來做交易,例如銀行的繳費(fèi),當(dāng)一條數(shù)據(jù)繳完后就不能再繳費(fèi)了,所以需要造大量的數(shù)據(jù)用來做性能測試,本文我們通過做某銀行校園卡繳費(fèi)性能測試,根據(jù)表的特點(diǎn),編寫的一個存儲過程,代碼如下:

 
 
 
  1. declare 
  2. busiId varchar2(20);
  3. corpId varchar2(20);
  4. termId varchar2(10);
  5. collegeId varchar(30);
  6. collegeName varchar(40);
  7. stuId varchar2(30);
  8. begin 
  9. busiId := '100104';  --業(yè)務(wù)代碼
  10. corpId := 'E000000059'; --委托單位
  11. termId := '0101'; --學(xué)期
  12. collegeId := '010590'; --學(xué)校代碼
  13. collegeName := '深圳大學(xué)';
  14. stuId := '59';
  15. --增加學(xué)校信息
  16. insert into 
  17. bib_booking_coll_info(busi_id,corp_id,term_id,term_flag,college_id,college_name,start_date,end_date)
  18. values(busiId,corpId,termId,'1',collegeId,collegeName,'20110520','20110527');
  19. --增加學(xué)校費(fèi)項(xiàng)信息
  20. for fee_num in 1..4 loop
  21. insert into bib_coll_fee_info(busi_id,corp_id,cost_code,cost_name)
  22. values(busiId,corpId,'100'|| fee_num,'費(fèi)項(xiàng)'||fee_num);
  23. end loop;
  24. --增加學(xué)生繳費(fèi)信息
  25. for student_num in 1..100000 loop 
  26. insert into bib_booking_student_info
  27. (busi_id, corp_id, term_id, stu_id, college_id, bank_acnt, stu_dep, stu_speciality, 
  28. stu_name, need_totalamt, stu_stat)
  29. values
  30. (busiId, corpId, termId, stuId||lpad(student_num,'6','0'), collegeId, '6029071032159548', '計(jì)算機(jī)科學(xué)', '計(jì)算機(jī)', 
  31. '測試'||student_num, '4', '0');
  32. --增加學(xué)生費(fèi)項(xiàng)繳費(fèi)信息
  33. for stu_fee in 1..4 loop 
  34. insert into bib_booking_fee_info
  35. (busi_id, corp_id, term_id, stu_id, cost_code, college_id, cost_amt, stu_stat)
  36. values
  37. (busiId, corpId, termId, stuId||lpad(student_num,'6','0'), '100'|| stu_fee, collegeId, '1', '0');                  
  38. end loop;
  39. end loop;
  40. commit;
  41. end;

看過以上的代碼,相信大家一定能了解SQL Server數(shù)據(jù)庫用存儲過程生成大量數(shù)據(jù)的方法了,本文就介紹到這里,希望能夠給您帶來一些收獲。


當(dāng)前標(biāo)題:SQLServer數(shù)據(jù)庫如何使用存儲過程造批量數(shù)據(jù)
本文來源:http://www.dlmjj.cn/article/dhpphhp.html