日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

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

新聞中心

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

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

 
 
 
  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è)務代碼
  10. corpId := 'E000000059'; --委托單位
  11. termId := '0101'; --學期
  12. collegeId := '010590'; --學校代碼
  13. collegeName := '深圳大學';
  14. stuId := '59';
  15. --增加學校信息
  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. --增加學校費項信息
  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,'費項'||fee_num);
  23. end loop;
  24. --增加學生繳費信息
  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', '計算機科學', '計算機', 
  31. '測試'||student_num, '4', '0');
  32. --增加學生費項繳費信息
  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ù)的方法了,本文就介紹到這里,希望能夠給您帶來一些收獲。


網(wǎng)站欄目:SQLServer數(shù)據(jù)庫如何使用存儲過程造批量數(shù)據(jù)
標題來源:http://m.5511xx.com/article/dhpphhp.html