Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can VFP change a field Name
Message
From
26/05/2009 09:24:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
26/05/2009 02:37:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01401923
Message ID:
01401948
Views:
74
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform