eteran
asked on
SQL LOOP
I have this code in which I got help in by other experts in the system. This code gose to a txt file which I download everyday and for now only prints what is in the text file. What I want to accomplish is a delete all record of the table and then begin by uploading the new records one by one. Is there a way to do this. How do I structure the sql with the loop every record is split by "miamimls". Can someone please help.
<%
Const ForReading = 1
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objTextFile = objFSO.OpenTextFile("c:\se fl_data.tx t", ForReading)
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ",")
' Response.Write "Server name:" & arrServiceList(0)
For i = 1 to Ubound(arrServiceList)
Response.write " " & arrServiceList(i)
response.flush
Next
Loop
%>
"miamimls","FL","M1172181" ,"1025193" ,"Clarte Int'l Properties LLC","3055322226","1274527 ","Penuela ,Pablo","" ,"","","", "","M","CO NDO","FULL SERVICE 5 STAR HOTEL. UNIT WITH OCEAN VIEW. FULLY FURNISHED BY DESIGNER, TOP OF THE LINE APPLIANCES, LUXURIOUS LOBBY, PRIVATE BEACH WITH CABANAS","A","379900",""," FL","18683 ","COLLINS AV","","","2309","-80.1206 0909860296 ","25.9490 3129272457 ","SUNNYIS L","000016 ","33160", "","22","D ADE","1202 5","M Resort Le Meridien","M Resort Le Meridien","2005","","","0" ,"","750", "1","1","1 ","0",""," ","","","" ,"","","", "","",""," 823","","M RESORT RESIDENCES CONDOUNIT 2309 INDIV 0.338131% INT IN COMMON ELEMENTS OFF","31-22-02-045-2309"," 4150","200 6","2","", "22","","" ,"","09/12 /2007","", "","",""," ","","","" ,"","","", "","",""," D09,E05,J0 2,J04,M01, M05,M17,N1 0,N11,N13, N19,Q08,T0 1,T28,U01, U16,W28,X0 7,X09,X12, Y07","CIPL 01","31277 20","","0" ,"",""
---------- NEW RECORDS------------------- ---------- ---------- ---------- ---------- ----------
"miamimls","FL","M1172187" ,"1024855" ,"Astor International Realty","3054876265","2120 357","Varg as,Limaris ","","","" ,"","","M" ,"CONDO"," O","A","32 4900",""," FL","6001" ,"70 ST","","NW","439","-80.291 0122138751 6","25.706 1298175342 72","SMIAM I","Y22922 ","33143", "","40","D ADE","1202 5","","VAL ENCIA SOUTH MIAMI","2004","","","1010" ,"","1010" ,"2","2"," 2","0","", "","",""," ","","","" ,"","","", "428",""," TOWNSITE", "","0","20 06","25"," ","40","", "","","09/ 12/2007"," ","","","" ,"","","", "","",""," ","","","" ,"C02,C05, C13,C23,D0 9,E05,J02, J07,M01,M0 5,M17,N02, N10,N11,N1 9,O14,O17, Q01,T02,T1 1,T12,T28, U01,W28"," AITR01","3 160259","" ,"0","",""
<%
Const ForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objTextFile = objFSO.OpenTextFile("c:\se
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ",")
' Response.Write "Server name:" & arrServiceList(0)
For i = 1 to Ubound(arrServiceList)
Response.write " " & arrServiceList(i)
response.flush
Next
Loop
%>
"miamimls","FL","M1172181"
---------- NEW RECORDS-------------------
"miamimls","FL","M1172187"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
didn't you want to delete all records in that table?
your questions stated:
"What I want to accomplish is a delete all record of the table..."
your questions stated:
"What I want to accomplish is a delete all record of the table..."
ASKER
yeah, so that sql you worte dose that. I don't have to fo somehting like this
objConn.Execute "Delete * From Table Where MLSCONTAINER"
objConn.Execute "Delete * From Table Where MLSCONTAINER"
Have you been able to test the code?
ASKER
no canget get it to mix wityh my code i postedl. can you please help.
ASKER
now the problem is that I only need to insert 3 colums of the data. The 3rd, 89th, 90th colum of the array in the data base to the three fields in my database posted below. How do I go about doing this.
<%
Const ForReading = 1
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objTextFile = objFSO.OpenTextFile("c:\se fl_data.tx t", ForReading)
objConn.Execute "Delete From Table MLS_Picture_Control"
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ",")
' Response.Write "Server name:" & arrServiceList(0)
For i = 1 to Ubound(arrServiceList)
Response.write " " & arrServiceList(i)
strSQL = "INSERT INTO MLS_Picture_Control MLS_LISTING_ID, PHOTO_QUANTITY, PHOTO_URL ('" &arrServiceList(i)& "')"
objConn.Execute strSQL
response.flush
Next
objConn.Close
set objConn = nothing
%>
<%
Const ForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objTextFile = objFSO.OpenTextFile("c:\se
objConn.Execute "Delete From Table MLS_Picture_Control"
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ",")
' Response.Write "Server name:" & arrServiceList(0)
For i = 1 to Ubound(arrServiceList)
Response.write " " & arrServiceList(i)
strSQL = "INSERT INTO MLS_Picture_Control MLS_LISTING_ID, PHOTO_QUANTITY, PHOTO_URL ('" &arrServiceList(i)& "')"
objConn.Execute strSQL
response.flush
Next
objConn.Close
set objConn = nothing
%>
For i = 1 to Ubound(arrServiceList)
Response.write " " & arrServiceList(i)
If i = 3 or i = 89 or i = 90 Then
strSQL = "INSERT INTO MLS_Picture_Control MLS_LISTING_ID, PHOTO_QUANTITY, PHOTO_URL ('" &arrServiceList(i)& "')"
objConn.Execute strSQL
response.flush
End If
Next
Response.write " " & arrServiceList(i)
If i = 3 or i = 89 or i = 90 Then
strSQL = "INSERT INTO MLS_Picture_Control MLS_LISTING_ID, PHOTO_QUANTITY, PHOTO_URL ('" &arrServiceList(i)& "')"
objConn.Execute strSQL
response.flush
End If
Next
ASKER
objConn.Execute "Delete From Table Where...."