Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I change a fieldname - programatically
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01439486
Message ID:
01439493
Vues:
47
>I have a fieldname as a variable - lcOldName, and the new field name is a variable as well. lcNewName.
>
>I can get the type of field, size etc from the old one...
>
>I tried the following, but couldn't get the syntax to work...
>i.e.
>add table (lcTableToFix) alter column (lcOldFldName) (lcNewName)
>
>I tried add the column and then moving the data from old to new and then dropping old column
>
>So if you have an example on how to do this, I guess its late and a long day nothing is clicking right now.
>
>Thanks all,
>Mike

Mike,

This is a quick test I just tried:
CREATE CURSOR test (charfield C(10))
ALTER table ('test') RENAME COLUMN ('charfield') TO ('NewField')
brow
So,
alter table (m.lcTableToFix) rename column (m.lcOldFldName) to (m.lcNewName)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform