Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who should create the PK, view or table?
Message
De
13/09/2004 17:43:02
 
 
À
13/09/2004 09:15:10
Jim Winter
Jim Winter Consulting
Hinesburg, Vermont, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00941514
Message ID:
00941735
Vues:
14
>>I may add to Hilmars that if you add the pk to the view, a concurent view somewhere else will not know about the new pk and may use it also. You will not know when a new view - record is written to its table. Then you will have two new records (in view) with the same pk.
>
>You can overcome this problem by using GUIDs for your primary keys. And there are some instances where you may need the primary key before you save the view to it's table. For example, if you add a child record in a child view, you will want to populate it's foreign key with the parent's primary key.
>
>Regards,
>
>Jim

In this scenario you have to create the PK in the view. I use views mostly for children tables, so I did not thought about this.
I store the PK in a separate table, so I don't need GUIDs. If I create twice the PK (in the table and in the view), I thought I was wasting PKs; to my surprise it was not the case. I have to research deeper to know why didn't VFP created twice the PK.
Besides, I was not really concerned about wasting PK, as with an integer type I get 4 billion PK (including negative integers).

Thanks,
Javier.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform