Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AutoInc data type
Message
De
16/04/2003 15:40:18
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00778507
Message ID:
00778554
Vues:
23
>I have a field which uses the new AutoInc Integer type, and I would like to get the new ID value after I issue an INSERT INTO statement. Something like @@Identity in SQL Server. Is it possible?
>
>

If you know the name of the primary key field:
INSERT INTO table1 ....
? table1.keyID
If your program doesn't know the name of the primary key field, see KEY(), TAGCOUNT(), PRIMARY() functions...your code can figure out the name of the primary key field. Then use eval() to get the new key:

For example, assuming the primary key is the first index tag:
lcKeyField = "table1." + key(1)  && you'd have to SELECT the table, and then set the work area back
? eval(lcKeyField)
Steve Gibson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform