|
日時: 2015/07/06 12:55
名前: lightbox
|
日時: 2015/07/06 12:55 名前: lightbox
拡張子:
' **********************************************
' 社員マスタ
' **********************************************
strName1 = "山川森鈴木高田本多村吉岡松丸杉浦中尾安原野内"
strName1k = "ヤマ,カワ,モリ,スズ,キ,タカ,タ,モト,タ,ムラ,ヨシ,オカ,マツ,マル,スギ,ウラ,ナカ,オ,ヤス,ハラ,ノ,ウチ"
strWork = ""
strName2 = "和元雅正由克友浩春冬洋輝"
strName2k = "カズ,モト,マサ,マサ,ヨシ,カツ,トモ,ヒロ,ハル,フユ,ヒロ,テル"
strName3 = "男也一行樹之"
strName3k = "オ,ヤ,カズ,ユキ,キ,ユキ"
strName4 = "子代美恵"
strName4k = "コ,ヨ,ミ,エ"
' 件数
WScript.Echo "社員マスタとデータを作成しています...."
WScript.Echo "作成件数は " & nMax1 & " 件です"
For i = 1 to nMax1
Query = "insert into [社員マスタ] values("
Query = Query & Ss(Fzero( i , 4 ) )
' 姓1文字目
nTarget = MyRandom( 1, Len(strName1) )
strName = Mid( strName1, nTarget, 1 )
aData = Split(strName1k,",")
strKana = aData(nTarget-1)
' 1文字目と2文字目が一致したら除外
nTarget2 = nTarget
Do while( nTarget = nTarget2 )
nTarget2 = MyRandom( 1, Len(strName1) )
Loop
' 姓2文字目
strName = strName & Mid( strName1, nTarget2, 1 ) & " "
strKana = strKana & aData(nTarget2-1) & " "
' 名1文字目
nTarget = MyRandom( 1, Len(strName2) )
strName = strName & Mid( strName2, nTarget, 1 )
aData = Split(strName2k,",")
strKana = strKana & aData(nTarget-1)
' 性別
nTarget = MyRandom( 0, 1 )
nS = nTarget
' 性別によって名2文字目を決定
if nTarget = 0 then
nTarget = MyRandom( 1, Len(strName3) )
strName = strName & Mid( strName3, nTarget, 1 )
aData = Split(strName3k,",")
strKana = strKana & aData(nTarget-1)
else
nTarget = MyRandom( 1, Len(strName4) )
strName = strName & Mid( strName4, nTarget, 1 )
aData = Split(strName4k,",")
strKana = strKana & aData(nTarget-1)
end if
Query = Query & "," & Ss( strName )
Query = Query & "," & Ss( strKana )
nTarget = MyRandom( 1, 3 )
Query = Query & "," & Ss( Fzero( nTarget, 4 ) )
Query = Query & "," & nS
strWork = Date() - MyRandom( 0, 100 )
Query = Query & "," & Ss( strWork )
strWork = Date() + MyRandom( 0, 100 )
Query = Query & "," & Ss( strWork )
Query = Query & "," & MyRandom( 14, 30 ) * 10000
if i mod 5 = 1 then
Query = Query & "," & MyRandom( 5, 10 ) * 1000
else
Query = Query & ",NULL"
end if
if i <= 5 then
Query = Query & ",NULL"
else
Query = Query & "," & Ss( Fzero( MyRandom( 1, 5 ) , 4 ) )
end if
Query = Query & ")"
Cn.Execute Query
Next
|