Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modified already installed table structure - how?
Message
From
03/09/1999 00:13:04
 
 
To
02/09/1999 23:20:00
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00260983
Message ID:
00261006
Views:
27
>>>I have a table that is already being used in an installation. I need to modify the table structure to repair a bug and remove an unneeded field. The only way I know how to modify table structures is to use the Project Manager but that is NOT available on the clients site.

The "Old-fashioned" method involves detailing the exact differences between the two version of the tables, and writing code to make the old one like the new.

>>>#1 - How do I change an existing field type from character 15 to integer 4?

ALTER TABLE MyTaable ALTER COLUMN MyField I

Be aware that you will probably lose data here, and if oyu need to preserve anything in the field, oyu will want to do this in a couple of steps: adding a new column, populating it with VAL(OldField), deleting the old field, and then renaming the new to the old.


>>>#2 - How do I remove a field from the a table?

ALTER TABLE MyTable DROP COLUMN MyField

>>>#3 - How do I add a field to a table?

ALTER TABLE MyTable ADD COLUMN MyField C(10)

>>>#4 - I assume I am updating the clients existing database (somehow), but if I make these changes - what do I need to copy to the clients system. .dbc, .exe, ...)?

You don't need to copy the dbc- it will be updated when you make the structure changes. You on;y need to copy a new exe if the exe has code in it that references the old fields, and the code needs to be updated.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform