i have a front end in access and back end is sql server 2008
one of the fields is the account number and here are the rules
it is a zipcode like 92111 plus a dash plus a number.
so the first one would be 92111-1, the second 92111-2
this has to do with how many clients we have in the zip code
i would like this zip code to be automatically generated. here is what i need:
what is the proper way of doing this?
I agree with HansUp that you should keep the ZIP and sequence separated. You can create an indexed computed field called AccountNumber which joins the zip and sequence.
The only way I know of doing this is locking the table, selecting max(sequence) ... where ZIP = 12345
, inserting the new record, then unlocking the table. However, locking the table means everyone else has to wait, greatly affecting scalability. I can't recommend this, but I don't have another solution.