Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add a column at a particular position?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01018285
Message ID:
01018402
Views:
20
I know. But this command is inlcluded for backward compatibility from VFP5 till VFP9 :o))


>Hi Borislav,
>
>Thanks for this simplier approach. According to the help file in VFP8, the Insert command is included for backward compatibility already, perhaps the other way suggested by you is better in the long run.
>
>
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform