Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing tables contained within a Database Container
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00367297
Message ID:
00368280
Vues:
28
>Hi Bruce,
>
>I don't have the luxury of simply changing the table structure and copying the database and changed file to a new
>directory. My situation is there's historical data that must be retained, the file structure of the old table is different
>and there's new indexes to be setup. Maybe if I had a blank changed table in the database to start off I can pass
>the old file setting up the changes to some of the fields then append the old data to the new table, would that be
>a better approach to this ?

Yes, maybe. - well, the best long-term solution would be as Ed or Brien suggested, get a DB tool to assist you.

But for your situation, if you don't have too many fields, sure, you can create a loading table with two sets of fields, one new set and one to exactly match the old set. Then do an APPEND to import the old data, and REPLACE ALL to reformat the old data to the new fields, if I understand your needs here. Just use the straight APPEND to any fields that do not require reformatting. Do an ALTER TABLE DROP to get rid of the old fields, or another APPEND to a third table after that, to get a clean new table. I've done exactly this before, when doing major DB restructuring or awkward textfile importing.

Note: Add indexes as needed afterward, do not attempt an APPEND with indexes, it will take forever.
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform