Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving an auto-incremented value
Message
 
À
29/09/2004 07:48:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00947113
Message ID:
00947117
Vues:
14
Why David, You can just store the field value toi some variable
Supposing that Fld1 is AUTOINC
BEGIN TRANSACTION
INSERT INTO the parent table (fld2, fld2) VALUES (value_for_fld2, value_for_fld3)
fld1_value = the parent table.Fld1
INSERT INTO the child table (Fld_with_value_for_paren_table_Fld1) VALUES (fld1_value).
END TRANSACTION
>I have a child table and a parent table ; in the latter i use a autoincrement primary key. I have to insert (using SQL) in the child table and the parent table at the same time. So obviously I need to
>1) Begin a transaction
>2) INSERT INTO the parent table.
>3) Retrieve the generated value of the autoincrement primary key.
>4) INSERT INTO the child table using this value.
>5) Commit the transaction.
>From what I found to read here, and what I didn't found to read in the documentation, it would appear that step 3 (retrieving the auto-incremented key) is not supported in VFP 8.0, which I find hard to believe, to say the least.
>If it is really the case, what is a concurrency-safe workaround ? Forgetting about autoincrement and writing all the auto-incrementing code by myself ?
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