Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foreign Key Programmatic Syntax?
Message
De
10/01/2001 18:14:33
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00461952
Message ID:
00461983
Vues:
11
>Trying to hand-code some database creation, specifying primary and candidate and foreign keys.
>
>Does anyone have any sample code showing foreign key generation between n tables?
>
>VFP6/SP4.
>
>Thanks.

Primary and Foreign key creation - table must be in a database to use these
create data test
create table one (id i primary key, ctest c(10))
create table many (id i, ctest c(10))
index on id tag id
alter table many add foreign key tag id references one tag id
Candidate keys are created using the Candidate keyword in the INDEX command (tables do not have to be in a database to have candidate keys)., e.g.,
index on id tag id candidate
If you already have a database, run GenDBC (or GenDBCX) - it comes with VFP - against it. Throw all the goodies you can into the database (pk's, fk's, relations, stored procedures, etc.) and learn from the GenDBC output file how to handle each thing.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform