>>>Just curious what folks think out there regarding what's the best way to generate key field values when adding new records to tables.
>>>
>>>When my users click the ADD button, I've been running code to use the table in the key field order, go bottom, find the last value and add 1 to it for the new record's key field value.
>>>
>>>It seems to be working fine, though I realized I had to play with my SET DELETED ON/OFF commands so my next value was unique and not the same as a deleted record's.
>>>
>>>I know some folks keep separate tables to track the next available key value for their tables. I'm assuming it looks like a 2 field table, one for the table's name, one for the next value. You'd then check there for the next value you want to assign.
>>>
>>>Any way better than any other??
>>
>>In order to avoid problems with DELETED key values, I have been using expressiones like this for my primary indices:
>>
>> IIF(DELETED(), -RECNO(), <>)
>>
>>(Of course, my primary key field is never negative.)
>>
>>However, this solution isn´t very good for it hampers Rushmore, so I add a *regular* index on <> just for SQL and Rushmore.
>>
>>HTH!
>
>Oops... where it reads "<>" it should read ""; I don´t know how/where/why it disappeared!
This is getting sort of ridiculous... I wanted to write "my primary key field" between "<" and ">" brackets, and somehow the text just doesn´t appear, though I can read it when replying. Sorry for the long sequence of replies!!
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