Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ALTER TABLE and INSERT INTO not working
Message
From
13/12/2006 04:43:30
Michael Gass
Instructional Software, Inc.
Kirkland, Washington, United States
 
 
To
13/12/2006 04:37:21
Michael Gass
Instructional Software, Inc.
Kirkland, Washington, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01177095
Message ID:
01177096
Views:
10
Sorry, here's the corrected code.
LPARAMETERS curtable, oldtable
LOCAL old,cur,afieldname,afieldtype,afieldsize,zfieldtoadd
 
  old = FCOUNT(oldtable)
  cur = FCOUNT(curtable)

  SELECT (curtable)
    = AFIELDS(aMyStruc, (curtable))  && structure array for currentfile
    do while old <= cur 
        old = old + 1
        afieldname  = aMyStruc(old,1)
        afieldtype  = aMyStruc(old,2)
        afieldsize  = aMyStruc(old,3)
        zfieldtoadd = afieldname + " " + afieldtype + ;
            "(" + LTRIM(STR(afieldsize)) + ")"
        SELECT (oldtable)
        ALTER TABLE (oldtable) add column (zfieldtoadd)
    ENDDO

    SELECT (curtable)
    INSERT INTO (curtable) SELECT * FROM (oldtable)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform