>Hi All. I have been reading some threads about SCAN - ENDSCAN. Due to old habits I have used DO WHILE but am interested in the speed improvements that SCAN ENDSCAN appear to offer.
>
>Any gotchas to watch out for when converting DO WHILE loops to SCAN ENDSCAN? I did read Dragan's comment about nested SCAN's on the *same* file. Are there any others?
hi Jos
i have never considered using a "Do While" in place of a Scan, but i have tested a scan loop to a SQL against a well indexed table with about 90000 records.
the scan looked something like this:
sele MyTable
set order to MyIndex
seek MySeekExp
scan rest while MyTable.Field1 = MySeekExp
...
endscan
the sql was something like this:
sele q_a.* from MyTable q_a where MyTable.Field1 = MySeekExp into cursor cur_MyTest
the speed difference was very small - almost the same. however, when run a comparisen with a 'complex' sql command (like an sql within an sql) - the sql became so 'slow', that the scan was faster. I tested this in Vfp6 SP5.