Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I change a fieldname - programatically
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01439486
Message ID:
01439493
Views:
48
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform