A set users each may have an AccountNumber, so in order to create a new account, I will increment the highest existing account number by 1. How would you keep track of the last issued number? Of course one could loop through all accounts to check, but is there any reason why one would perhaps chose to keep a separate table of either the last issued number, or all numbers?
I’m just looking at a few thousand accounts, so it’s not that i’m worried about optimization.
You should probably use
IDENTITYif you’re using MS SQL, or equivalent if you’re using some other DB.That will keep track of the ids properly, even when two people are trying to create an account at the same time.