Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verify if a field already exists in a table
Message
De
19/06/2009 16:53:58
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
18/06/2009 16:09:10
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01238247
Message ID:
01407310
Vues:
57
>>>Is there any other way to change the structure of the existing table?
>
>We used to change structure programmatically by creating a temp table with the new structure, appending the old data into it, renaming the existing table as .bak, then renaming the temp table as the original table. But it doesn't work so well if your table is in a dbc.

This can be improved if you create a temp dbc, then copy to a new table in that dbc (there's a syntax for that in the copy command); at least you can get the long field names and indexes. Other extended dbc-bound properties are a tad tougher.

But if you create a whole new directory with the new tables, database etc, and then append only where structure is different (i.e. the whole arrays you get with ataginfo() and afields() are not identical), otherwise just copy files as they are, then rename directories - that works, and isn't too slow either. The plain file copy is fast even on big tables, and the tables where you still have changes probably didn't have the time to grow too much... but then even if they did, you'd have to spend pretty much the same time.

Either way, you need to be alone with the tables for the duration of this, or else you may get a dirty copy - parent-child relations may be out of sync, various orphans or mismatches may happen. Using Alter Table may look better, if you want to manage it manually... and have to do it fast.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform