• subscribe
August 28, 2008 12:00 AM

Q: How can I create unique primary keys that are easy for customers to use?

SQL Server Pro
InstantDoc ID #99385

Q: I use a disconnected architecture in which sales agents take their systems to the field and add new customers. How can I create unique primary keys that are easy for customers to use? We have a few thousand customers, so an integer (rather than a GUID) would be best and easiest for the agents. However, I want to leave a printed invoice with customers that shows their real customer numbers.

A: I suggest using the “sales book” technique for this architecture. That is, the salesperson is given a preprinted set of invoices that include the unique primary key value. Back in the office these values can be scanned into the system. Because no two sales books have the same sequence, you won’t have any collisions. You could accomplish the same result with a paperless approach that preassigns a block of rows to a specific salesperson. When the data is entered, the application uses one of the prepopulated data rows so there are no INSERT operations, just UPDATES. Collision avoidance is easy. Because the salesperson “owns” the row, no other applications can change the data until populated on the server. This occurs when the salesperson gets back in touch with the home office and posts updates.

—William Vaughn



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...