Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can VFP change a field Name
Message
De
26/05/2009 09:24:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01401923
Message ID:
01401948
Vues:
73
>Several of the fields in my database have dates associated with them- (I know it was a terrible idea to begin with) but the field is called eg. data06, data07,data08. When a new year rolls around, the operator needs to physically change the name of the oldest field: data06 to data09.
>
>Is there anyway to do this programmatically. IE is there a way to have VFP modify an actual field name using code.
>
>thanks for any suggestions - (that don't involve me re-engineering database structure that date back 12 years.)
>
>k

Do you really want to RENAME the field, or rather delete the oldest field and add a new one? The difference is, if you rename the field, you will keep the data from 2006 in your example.

To delete a column, and add another one (this will delete the 2006 data):
alter table ... drop column data06
alter table ... add column data09 Y && assuming type currency, else change "Y" to "N(10,2)" for example
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform