How are you going to use them? Will you need to do arithmetic on account numbers? Will an account number consist of parts like a branch number + ID where you'll need to pull them apart?
Generally speaking, I would suggest not thinking about what data type to force it into, but think about how you will use it now, and possibly in the future. Let those considerations determine how to store it.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree with Fred. In fact, it may be better to create a bank account type, so you can hide the implementation details.
Joined: Jul 03, 2009
Thanks for the replies! I won't have to perform any arithmetic on the bank account numbers after they are generated. Would it be a good idea to generate each one using random number generator (and check for duplicates) or generate one account number and keep incrementing each of the other ones by 1? How do Banks do it? Thanks again..
John de Michele
Joined: Mar 09, 2009
I would guess that banks probably do it sequentially in some manner (maybe with blocks of numbers to each branch), since random account generation would have to deal with possible duplicates as you mentioned.