>Glad you asked, look what I found out, and listen to my theory
>
>acctually the "curictfer" cursor is created using a SELECT statement against a REMOTE VIEW like a direct select within the Visual foxpro environment, and not as a SQLEXEC command against the Back end.
>
>I guess the first is slower than the second choice, right?
>
>after getting the Data then the code i just posted is performed using a SQLEXEC command for each one of the records on the cursor. even describing the procedure feels slow, doesn't it? LOL
>
>My theory is that if I change this behavior and instead of using a SELECT statement against a REMOTE VIEW like a direct select within the Visual foxpro environment, I change this and send a SQLEXEC to the backend and store the data on a TEMPDB table, then the second step, instead of using the SCAN and SQLEXEC command for each one of the records on the cursor to insert it to the back end i use a BULK insert using a INSERT INTO theTable SELECT * FROM #TempTable this would improve the speed a lot
>
>what do you think? am i right? or like we say in my country , I am so lost as a Dog in a 4th of July Parade?
Yes that should be faster, but there is no need to have temp table. You could do this:
TEXT TO lcSQL NOSHOW
INSERT INTO theTable
SELECT ......
FROM .....
WHERE ....
ENDTEXT
IF SQLEXEC(..., lcSQL) < 0
AERROR(laError)
MessageBox(laError[1,2])
ENDIF
Where SELECT ...... FROM ..... WHERE .... is the same select you would use to create temp table.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.