Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Who should create the PK, view or table?
Hi all,
When adding records with views I don't where is the best place to create the primary key, the view or the table.
I generate the PK with a newId() function, and I don't know whether to put it on the default value of the view field or the default value of the table itself. I "have" to put the code in the table just in case I don't use the view; so I thought that if I inserted the newId() in the view I would end up creating twice the PK (and wasting PK), but I tested and it was not the case. So I don't really know what should I do from a "good practices" point of view.
TIA,
Javier.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement