Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a table from a table of a structure
Message
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:
01333648
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.
select myOriginalTable
local aStru(1)
=afields(aStru)
create cursor mytemp from array  aStru
alter table alias() add column...
.
.
copy to myFreeTable
select mytemp
use
Problem here could be long fields names if you use them, otherwise works for me.
If table is part of database with triggerrs and all that then folowing function might be usefull;


Function below will fill up an empty array already created / passed as parameter
with 'fat-free' table fields structure (4 out of 16 columns) convinient for creating tmp cursors
As original Afields it also returns back number of fields
function afields4
    lparameters lArray
    local lArrStru(1) , i , j
    declare lArray(afields(lArrStru), 4 )
    for i=1 to alen(lArrStru,1)
        for j = 1 to 4
            lArray(i,j) = lArrStru(i,j)
        next
    next
    return alen(lArray,1)
HTH
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Reply
Map
View

Click here to load this message in the networking platform