Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ALTER TABLE and INSERT INTO not working
Message
De
13/12/2006 04:43:30
Michael Gass
Instructional Software, Inc.
Kirkland, Washington, États-Unis
 
 
À
13/12/2006 04:37:21
Michael Gass
Instructional Software, Inc.
Kirkland, Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01177095
Message ID:
01177096
Vues:
11
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform