Hi Markus:
What machine are you using, I read in your code you achieve results near to 21 seconds. I can't reach anything close to that.
>Hi Thomas,
>
>>well, less lines should run faster at least in vfp...
>
>I checked your suggestion and indeed having less variable assignments nearly cuts the CSV export time in half. I just left out STRTRAN() because the original STUFF() is a bit faster (only 0.03 seconds less at 500,000 records, but anyway ;-)).
>
>This is the new CSV export code:
>
>SELECT Table2
>SCAN
> lcName = RTRIM( Name )
> lcStrasse = RTRIM( Strasse )
> FPUTS( m.lnFHandle, ;
> STUFF( m.lcName, RAT( " ", m.lcName ), 1, ", " ) +", "+ ;
> STUFF( m.lcStrasse, RAT( " ", m.lcStrasse ), 1, ", " ) +", "+ ;
> STUFF( RTRIM( Ort ), AT( " ", Ort ), 1, ", " ) +", "+ ;
> RTRIM( eMail ) )
>ENDSCAN
>
>
>OTOH this is only about 0.1 seconds faster than my original version but way worse to read. Part two of the contest (remove duplicates and create a table with a different structure) is still more than 17 seconds. The commands I used are INDEX ON...UNIQUE, COPY TO and SELECT...INTO TABLE.
>
>Markus