Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GUIDs as primary keys in SQL 2K tables?

Status
Not open for further replies.

BrianB

Programmer
Oct 2, 2000
186
US



Hi folks,

I am working on a distributed VB.NET/SQL2K db application that needs the ability to work independently of the database for a time, creating and modifying orders.

While the connection is down, we are assigning GUIDs to every object the user creates (customers, orders, line items, etc.) rather than using conventional auto increment integers. We use System.Guid.NewGuid.ToString to do it. On the client, we manage the relationship with collections, ie. the order class has a collection of lineitems objects, etc.

The db records on the server use regular auto incrementing integers. Therefore, when they synchronize, we are getting the ID numbers and assigning them to the remotely created orders. (This gets a little hairy for parent/child relationships, but it is manageable with enough FOR EACH loops).

There is, of course, another option: we could just keep the GUIDs that we generate on the client and store them as our primary keys in the DB. Does anyone have any comments on using GUIDs instead of integer primary keys? Is this a good idea/bad idea?

Thanks in advance.

Brian

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top