Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a table from a table of a structure
Message
From
23/07/2008 11:57:27
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01333451
Message ID:
01333461
Views:
9
>>I have gone brain dead. Its only taken 55 years. I have created a table of the structure of another table. I have appended a few fields to the structure table. Now I want to create a new table with the entire new structure. I can't remember the statement syntax to do it.
>>
>>Any help will be greatly appreciated.
>>
>>Brad
>
>A few more ways:
>
>SELECT * FROM YourTable WHERE .f. INTO TABLE NewTable
>
Let's not forget

copy next 0 from yourtable to yournewtable [cdx]

>
>SELECT YourTable
>AFIELDS(laFields)
>CREATE TABLE NewTable FROM ARRAY laFields
>
>
>be careful with the last one. You cold have problems if the standard table belongs to Database but you create new one as free table.


At least I can report that the old bug was fixed (somewhere in VFP 7, 8 or 9 - haven't checked meanwhile). Up to VFP6, I think, this would error on the last line:
CREATE TABLE stuff\test_ (_fld1 c(10), _fld2 i)
AFIELDS(aa)
CREATE TABLE stuff\test_2 FROM ARRAY aa
and the error would be something about invalid or duplicate field name. The nature of the bug was that you couldn't create a field with a name beginning with an underscore FROM ARRAY. All other ways worked, just from array would cause an error. Luckily, this being Fox, anything can be done at least three ways or just isn't worth doing :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform