john w wrote:I will be honest I don't know anyone using guide as primary keys. It seems to me it would complicate that whole primary key foreign key relationship. For similar reasons the docid may not be a good choice for primary key. I forget how many characters are in the guid but to me it is neither logical or easily remembered. While it is self generated so is a primary key field set as an identity constraint
John,
At first it does not seem intuitive, but I agree with the documentation that when you start to deal with multiple databases (think mobile and server instances) you could have problems when a counter is used to generate primary keys.
For example, say I have an application that tracks accidents real time by letting users with their mobile devices add accidents as they see them while driving. If each user is adding an accident (whether their device is on or offline) then each is generating a new primary key with that new accident record. What happens if two or more users try to add an accident with a primary key of 1, 2, 3...? See the problem? Each database, depending on whether the application is using an offline local database or the server database, is only aware of its own generated keys.
From what I gather, the DocID or GUID would eliminate this problem since the key that is generated is unique across all domains/databases/whatever you want to call it.
By the way, it was page 39 of the User's Manual where I saw mention of DocID and GUID.
Giuseppe,
Could you elaborate more on this? Or correct me if somehow I've misinterpreted this.
Thanks!