Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a row to a table and delay setting PK
Message
 
 
À
09/03/2018 11:36:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
01658640
Message ID:
01658649
Vues:
41
>>A table in SQL Server has a PK column, Identity. I would like to be able to add a row/record to the table without actually setting the value in the PK column, until the VFP 9 application saves the row/record. I think the only way to do it is to be able to "get" the next PK value (Identity) without actually adding a row. Then, then user Saves the record, add new row. But then (as I type it, I realize) the PK column will get a new Identity value.
>>
>>Is something like I am describing above possible?
>
>A primary key with Identity definition will auto generate the value by itself. As soon as you insert a new row, that field is populated automatically by SQL Server. That is the best approach to use. There used to be a time when we had to use our own routines to generate such key. I haven't heard of that being done manually since years now.

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform