Click
1) If you use an updatable RV or SPT set buffering to 5.
2) You can use "copy to myTransfer.txt type delimited" and bulk insert
3) You can use DTS package
4) You can use OpenRowSet() SQL server function
Last one is one of the fastest I think. Below is partial class I've used for my own upsizing (fieldnames were same):
* Sample
oTransfer = CreateObject("SQLPutData")
oTransfer.PutTheData()
Define Class SQLPutData As Session
DataSession=2
DBPATH = Sys(5)+Curdir()+'myLocalDatabasePath'
LocalDBC = 'myLocalDatabase.dbc'
SQLDBNAME = "mySQLDatabase"
conHandle = .Null.
Procedure Init
This.conHandle = ;
Sqlstringconnect("Driver=SQL server;server=(local);Integrated Security=SSPI")
SQLExec(This.conHandle,"use ["+This.SQLDBNAME+"]")
Endproc
Procedure PutTheData
With This
.GetDataFrom("[dbo].[mytable]","[field1],[field2],[field3]")
SQLDisconnect(.conHandle)
endwith
endproc
Procedure GetDataFrom
Lparameters tcSQLName,tcFields
Local lcLocalTable, lcLocalFields, lcSQL, lnResult, ix, lcError
Local array arrErr[1]
lcLocalTable = Justext(Chrtran(tcSQLName,'[]',''))
lcLocalFields = Chrtran(tcFields,'[]','')
Text to m.lcSQL textmerge noshow
insert into ///m.tcSQLName////
SELECT ///m.tcFields///
FROM OPENROWSET('VFPOLEDB',
'///Addbs(this.DBPATH)+this.LocalDBC///';'';'',
'select ///m.lcLocalFields/// from ///m.lcLocalTable///')
endtext
lnResult = SQLExec(this.conHandle, m.lcSQL)
If m.lnResult < 0
AError(arrErr)
lcError = ''
For ix = 1 to Alen(arrErr)
lcError = lcError + Transform(arrErr[m.ix]) + Chr(13)
EndFor
MessageBox(m.lcError)
Else
? m.tcSQLName
endif
Endproc
enddefine
Instead of /// use << or >>