Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CDX file gets lost when I SORT?
Message
From
08/10/2001 12:12:03
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00565540
Message ID:
00565549
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
>Here's my code where I do a SORT of a table. My CDX files gets lost. I suspect it's my sort that clobbers my INDEX. How can I prevent this? Thanks.
>
>*************************
>* Sort Master Help file *
>*************************
>
>SET SAFETY OFF
>USE (helpfiledbf2) IN 0 SHARED
>SORT TO (helpfiledbf) ON contextid
>SELECT masthelp
>USE
>SET SAFETY ON
>
Hello Steve,

Since the SORT command creates a new table, I could see that the index would get wiped out. < SNIP >

BTW, a better way to physically sort the file is to use the COPY TO command. I would think it would be much faster this way.
use table1
set order to 1   && use the order that you want the new table to have
copy to table2
* rename table1 to something else (or delete it)
* rename table2 to table1
* create index on new table
Sidebar: I'm not really sure why the physical order of a table matters. You can use an index to get the order you need.

HTH,
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform