1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| strConnection = "Driver={SQL Server};Server=monServer;" & _
"Database=maBDD;Uid=monId;Pwd=monPwd;"
Set conn = Wscript.CreateObject("ADODB.Connection")
conn.Open strConnection
Set rs = Wscript.CreateObject("ADODB.recordset")
strSQL = "SELECT TOP 100 PERCENT BatchNumber AS BachNumber, SerialNumber," _
& " CardNumber, FaceValue, COUNT(*) AS Number, MSISDN, LEFT(TradeTime, 8) AS [Date]" _
& " From dbo.vouchercard_2007" _
& " where OperatedBy='NULL' OR OperatedBy='SYSTEM'and TradeTime='" _
& DateDebut & "'" _
& " GROUP BY BatchNumber, SerialNumber, CardNumber, FaceValue, MSISDN, LEFT(TradeTime, 8)" _
& " HAVING (COUNT (*) > 1)" _
& " ORDER BY LEFT(TradeTime, 8), SerialNumber"
rs.open strSQL, conn, 3,3
Do Until rs.EOF
BatchNumber = rs.Fields(0)
SerialNumber = rs.Fields(1)
CardNumber = rs.Fields(2)
FaceValue = rs.Fields(3)
VNumber = rs.Fields(4)
MSISDN = rs.Fields(5)
MaDate = rs.Fields(6)
rs.MoveNext
Nbre = Nbre + 1
LigneAffiche = BatchNumber & " " & SerialNumber & " " & CardNumber & " " _
& FaceValue & " " & VNumber & " " & MSISDN & " " & MaDate
f.writeline(LigneAffiche)
Loop
rs.Close
Set rs = Nothing
conn.Close
Set
conn = Nothing |
Partager