Subject How to implement sequential IDs with no missing vals?
Author Clay Shannon
We want sequential "admission numbers" in our app to be auto-generated for
the user (they need to see them, but getting the next sequential value
automatically rather than relying on the data entry people to always
accurately know what the next one should be).



A generator won't work, I don't think, because we don't want any missing
values. IOW, if the user starts a record, and gets number 123445 and then
for some reason doesn't complete the record, that number will be unused and
there will be a hole in the sequencing.



If I could wait until just before the post to grab the number, that would
probably solve it, but again, the user wants to see this number all through
the data-entry process.



Any ideas on the best way to implement something like this? The best thing
I've been able to think of so far is to select max(admission_number) from
the table and use the next number through the data-entry process, but query
for that value again just before posting and, if it has changed, increment
the number again and inform the user of the numbering change. There must be
a better way, though.



Clay Shannon,

Dimension 4 Software





[Non-text portions of this message have been removed]