0

I am not a DBA so I am scratching my head a bit. I am trying to put together an application for the company I work for. I need to provide a unique customer account number for each office location my company conducts business with.

In the past, I have based customer account numbers off a primary keyed INT columns setup to use incremented identities. I am wondering if this is the best or even worse option for this type of information.

What would you recommend? Thanks in advance for your help.

2 Answers 2

1

I would use a natural key, if you can find one. The problem with using meaningless keys is you can end up with duplicates that are difficult to recognize.

8
  • What do you mean by natural keys? At this point, the actual customer number that the users will see would be [Assigned Sales Rep Initials]-[Office-Identity Key] (ex JDO-15343). Mar 28, 2011 at 22:01
  • A natural key is one defined by the business, as opposed to an application making one up. Could you use your actual customer number as the primary or a unique key?
    – Beth
    Mar 28, 2011 at 22:04
  • I planned to have the actual customer number come from the identity key of the Customer table as I can tell you right now that the business would not want to define its own (manually anyway). Mar 28, 2011 at 22:06
  • No, I didn't mean the business defined the value manually, I meant the business knew what the key was supposed to be for each customer and could enter it themselves, as opposed to it being auto-generated by a database.
    – Beth
    Mar 28, 2011 at 22:08
  • 1
    Yeah, I'd avoid that if you can, just because the system can't know if a customer's been created twice. Consider using a main phone number, email address, taxID number, or something the business already has to track to distinguish them.
    – Beth
    Mar 28, 2011 at 22:23
1

We use an identity field for our accounts and user tables. By and large the account & user ids are meaningless outside your application. For example, few people care if their user id is 12345 or 1.

We're doing this on production websites.

1
  • Agreed. The account numbers will only be used as a reference on internal paper documents and QuickBooks invoices. A customer might refer to it once in a while, but my company is no where the size of a Verizon or TXU. Mar 28, 2011 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.