Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert field using Alter Table
Message
From
28/10/2007 16:48:27
 
 
To
28/10/2007 15:48:46
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01264579
Message ID:
01264616
Views:
17
>>>>Dear All,
>>>>
>>>>I want to programmatically insert field into database table after
>>>>specific field.
>>>>Normally Alter Table will add field on the bottom of fields order
>>>>whereas I want to add it let say as 3rd column in table.
>>>>
>>>>Is this possible and how ?
>>>>
>>>>TIA
>>>
>>>Not with ALTER TABLE, You could use AFIELDS to get all fields in array insert new array element at 3th position and then create table from that array, append records from all table, delete old table and rename newly created one to old name.
>>>The big question here is why?
>>
>>Answer to 'Why' question is much easier then 'How' which you proposed :)
>>There are functionalitis exposing fields for selection by user so I want simply for that field to appear in certain sequence.
>>My dbc upgrade routine will do this correctly, but I don't want to send entire database upgrade just for sake of one added column, so I tought this can be done somehow on the fly.
>
>If you have a meta-data table, add the field sequence to it and use that to display field names.
>
>It takes the same amount of time to alter table add column as it does to COPY ALL TO MYTEMP.DBF for 1 million records. This suggests the field is added to a new structure and the data is appended.

Have no million recorde table at hand to try but, probably the same thing happens when you change order of fields when you do modify structure.
It was wishfull thinking on my part :)
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Reply
Map
View

Click here to load this message in the networking platform