Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use varible name add fields to a table?
Message
From
15/10/2002 01:14:02
 
 
To
14/10/2002 22:56:06
Michale Chen
Shijiazhuang ZhiYuan Crop.
Shijiazhuang, China
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00711196
Message ID:
00711210
Views:
15
This message has been marked as a message which has helped to the initial question of the thread.
Michale

> I have a table need to add fields to a exact number? How can I do it? The following code have error ,How to change it?

To add to Sergey's correct reply that fieldnames cannot begin with a number, here is a way to do this.
LOCAL lni, lcFld
CREATE TABLE Temp (Field1 N(8))
FOR lni = FCOUNT("TEMP") + 1 TO 38
	lcFld = "Field" + LTRIM(STR(lni,2))
	ALTER TABLE Temp ADD COLUMN &lcFld N(8)
NEXT lni
BROWSE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform