Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add a column at a particular position?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
01018285
Message ID:
01018342
Vues:
16
David, Here a simple way. Again not tested. I don't know how long INSERT (old command not INSERT - SQL) will be supported.
USE YourTable
COPY STRUCTURE EXTENDED TO strYourTable
USE strYourTable EXCLUSIVE
GOTO 3 && Go to position where you want to insert the field
INSERT BLANK
REPLACE Field_Name WITH "FieldName",;
        Field_Type WITH "C",;
        Field_Len  WITH 10,;
        ..... && All neccessary fields 
CLOSE DATABASES ALL
CREATE Temptable FROM strYourTable
USE TempTable
APPEND FROM YourTable
*** DO ALL INDEX ON Here
CLOSE DATA ALL
ERASE YourTable.*
RENAME TempTable.DBF TO YourTable.DBF
RENAME TempTable.FPT TO YourTable.FPT && If you have a Memo/GENERAL/BLOB fields
RENAME TempTable.CDX TO YourTable.CDX
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform