Information générale
Catégorie:
Codage, syntaxe et commandes
>Can someone give me advice on the best way to assign primary key field values to individual records in a table. I have tables where the only unique value field is a description field. I don't want to use a 50 character description field as the primary key. I have routines to generate a key based on a counter. Is this the best way to assign values?
IMHO yes
what i do is as follows :
i have a table which holds the keys, thier type and the current value
and i have a routine in the stored procedure that takes as a parameter
the name of the key - serached the table increase the value by one
and return the new value
i call this funtion from the key field "default value"
HTH
Arnon Gal-Oz
Précédent
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