nitin1353
Constraint Violating Yak Guru
381 Posts |
Posted - 2005-07-12 : 13:54:28
|
Hi alli have thse kind of DTS packages in SQL server which i will be migrating to oracle.Please help as these packages are written in VB script.'**********************************************************************' Visual Basic ActiveX Script'************************************************************************Function Main()Dim rstLeads , rstsearch , cmdReport , strSQl , strFilePath ,cdoMsg , strBody , fso , rstCustomer ,flag,dt,out,substrsql, FstMortRatedim ltype,dphone,ephone,OpenDBdt="_" & Month(Date) & "_" & Day(Date) & "_" & Year(Date)Set OpenDB = Createobject("ADODB.Connection")Set rstCustomer = CreateObject("ADODB.Recordset")Set rstLeads = CreateObject("ADODB.Recordset")Set rstsearch =CreateObject("ADODB.Recordset")OpenDB.Open "Driver={SQL Server};DATABASE= ABC;SERVER=(local);"'OpenDB.Open "Driver={SQL Server};DATABASE=ABC;SERVER=(local);" strSQl="SELECT tbl_Lead.Lead_ID, tbl_Lead.Submitted, tbl_Lead.First_Name, tbl_Lead.Last_Name, tbl_Lead.Address, tbl_Lead.City, "strSQl=strSQl & " tbl_Lead.State,tbl_Lead.RemoteIP, tbl_Lead.ZIP, tbl_Lead.Day_Phone, tbl_Lead.Day_Phone_Ext, tbl_Lead.Evening_Phone, "strSQl=strSQl & " tbl_Lead.Evening_Phone_Ext, tbl_Lead.Email, tbl_Lead.Best_Time_To_Call, tbl_Lead.Annual_Income, tbl_Lead.Monthly_Income, "strSQl=strSQl & " tbl_Lead.source, "strSQl=strSQl & " tbl_dbconleadDetails.*, tbl_Lead.Ques_Comments, tbl_Customer.Customer_id,tbl_Customer.Company, tbl_Customer.[Name], "strSQl=strSQl & " tbl_CustLead.Status,tbl_CustLead.CL_ID FROM tbl_Lead JOIN tbl_dbconleaddetails ON tbl_Lead.Lead_ID =tbl_dbconleaddetails.lead_ID "strSQl=strSQl & " LEFT JOIN tbl_CustLead ON tbl_Lead.lead_ID = tbl_CustLead.Lead_ID "strSQl=strSQl & " LEFT JOIN tbl_Customer ON tbl_CustLead.Customer_ID=tbl_Customer.customer_ID "strSQl=strSQl & " WHERE Submitted Between dbo.datepart(getdate()) AND dbo.datepart(getdate()+1) and tbl_Customer.customer_id in(2654,2760)"strSQl=strSQl & " ORDER BY Submitted DESC "rstLeads.Open strSQL, OpenDB,3,1Do Until rstLeads.EOF substrsql="select * from tbl_submitnationalfound where lead_id='" & trim(rstLeads("Lead_ID")) & "'" rstsearch.Open substrsql,OpenDB,3,1if rstsearch.EOF thenDim myhttp,datatosend,sqldatatosend = "<?xml version=""1.0""?>" & vbnewlinedatatosend = datatosend & "<PARAMS>" & vbnewlineif rstLeads("customer_id")=2654 then datatosend = datatosend & "<auth username=""csi2"" password=""xml123"" campaignid=""1""/>"elseif rstLeads("customer_id")=2760 then datatosend = datatosend & "<auth username=""csi2"" password=""xml123"" campaignid=""6""/>"end ifdatatosend = datatosend & "<leads>" & vbnewlinedatatosend = datatosend & "<lead HomePhone=""" & rstLeads("day_phone") & """ FirstName=""" & rstLeads("first_name") & """ LastName=""" & rstLeads("last_name") & """"datatosend = datatosend & " Address1=""" & rstLeads("address") & """ Address2=""" & rstLeads("address") & """ City=""" & rstLeads("city") & """ State=""" & rstLeads("state") & """ Zip=""" & rstLeads("zip") & """" datatosend = datatosend & " EmailAddress=""" & rstLeads("email") & """ BestContactTime=""" & rstLeads("Best_Time_To_Call") & """ TotalDebt=""" & rstleads("unsecuredDbAmt") & """"datatosend = datatosend & " Fico=""500"" Derogs="""" IPAddress=""" & Ip_bittar & """ DateCreated=""" & date() & """ AltPhone=""" & rstLeads("evening_phone") & """"datatosend = datatosend & " AltPhone2=""" & rstLeads("evening_phone") & """"datatosend = datatosend & " VendersKey=""" & venkey & """ VendersSource=""" & sour & """ VendersRedirectURL=""4lowrates.com"" />"datatosend = datatosend & "</leads>" & vbnewlinedatatosend = datatosend & "</PARAMS>" & vbnewline'-------------------------------------'dim xml'xml = datatosendsql = "insert into tbl_submitnationalfound (lead_id,dateofsubmit,status,restext) values('" & trim(rstLeads("Lead_ID")) & "','" & now() & "','Fail','Failure')"openDb.execute(sql) Set myhttp=CreateObject("Msxml2.XMLHTTP") myhttp.open "POST", "https://clients.nfdm.org/filestesting/default.asp", falsemyhttp.setRequestHeader "lastCached", now()myhttp.setRequestHeader "Content-Type", "text/xml"myhttp.send datatosendstat=myhttp.statusrespo=myhttp.responseTextsql="update tbl_submitnationalfound set status='" & stat & "',restext='" & respo & "' where lead_id='" & trim(rstLeads("Lead_ID")) & "'"openDb.execute(sql)dim fss,filexml,strpathxmlset fss=CreateObject("scripting.FileSystemObject")strpathxml="d:\federalequity_tempCSV\testJohnBittar.xml"set filexml=fss.createtextfile(strpathxml)filexml.writeline(myhttp.responsetext)filexml.closeset myhttp = NothingrstLeads.MoveNextelserstLeads.MoveNextend if rstsearch.CloseLooprstLeads.closeset rstLeads=nothingset rstsearch=nothingOpenDB.closeMain = DTSTaskExecResult_SuccessEnd Function |
|