Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alternative to packing a table
Message
From
29/07/1999 14:03:04
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00247762
Message ID:
00247815
Views:
25
>>>I have heard that it is not wise to pack a table on a production system, especially when you're dealing with a fairly large table. ( 100,000+ ). Instead you do something like:
>>>
>>>PARAMETERS tcDbc, tcTableName
>>>USE (tcTableName)
>>>COPY TO TEMP DATABASE (tcDbc) FOR NOT DELETED()
>>>RENAME TEMP.DBF TO &tcTableName..DBF
>>>REINDEX
>>>* Or recreate the indexes one by one from a data dictionary
>>>
>>>1. Is the correct syntax.
>>>
>>>2. If its correct, is there a problem in VFP 5, where the copy to only copies the first 10 characters of field names.
>>
>>No problem I've ever had. I see a couple things, though:
>>
>>1) Add WITH CDX to the COPY or you'll lose the indexes
>>2) You'll lose some other DB table properties using your technique, if you have them.
>>3) You can use SET DELE ON instead of the FOR filter.
>>4) the RENAME may be confusing the DBC by putting the new table in a different path, perhaps that's why the 10-char names. Is that possible?
>>5) If something goes wrong with this method at runtime , you can be in hot water :) You might want to COPY TO a backup name also, in case...
>
>I forgot to add, upon relection you need to RENAME TABLE also with that method, and that means a REMOVE TABLE also. So the sequence (at least one I've tried before) goes something like:
>
>SET DATA TO etc
>SET DELE ON
>SELECT old (or USE old in 0)
>COPY TO temp DATA etc WITH CDX
>RENAME temp TO old && for file
>REMOVE TABLE old
>RENAME TABLE temp TO old && for DBC

I've tried this and it chokes when you try to re-open the table. It's looking for the backlink. I'm inclined to agree with Kenneth's assessment now.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform