Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verify if a field already exists in a table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01238247
Message ID:
01406911
Vues:
70
>>>How can I verify if a field already exists in a table?...
>>>Need to create it if doens´t....

>>
>>If it does not exist, add it
>>
>>If Fsize("MyField") = 0
>>   Alter Table MyTable Add Column MyField C(10)
>>EndIf
>>
>>
>>Another:
>>
>>If it does exist, drop it
>>
>>If Fsize("MyField") > 0
>>   Alter Table MyTable Drop Column MyField
>>EndIf
>>
>>Exclusive of course.
>
>I've looked at Help on ALTER TABLE and I don't see if it requires exclusive access or not.

Yes it is


>Also, does your code require to have the table opened? And why do we have INDBC(.. ) for the field? What good can the value return if it doesn't tell which table?


I don't know:-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform