Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GUID based on primary key
Message
 
À
25/08/2002 17:47:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00693475
Message ID:
00693499
Vues:
18
Michel,

as Jim already said, generating GUIDs out of another value is not possible. But IMO they won't do you too much harm, besides they are consuming space (32 Bytes in a VFP table stored as string and 16 Bytes when stored in SQL Server). In a VFP table you can set a default value function that returns a GUID and in SQL-Server you can use a built in function. So they won't afford any other coding.

BTW: I find GUIDs a very good approach for PKs. They are unique without any ID tables, can be created with a simple function call and can be generated totally offline or in the database.

HTH,
Armin


>Our tables contain primary keys, such as any other table. However, some specific XML requirement we have to deliver consists of sending the client a GUID that could be later use to query one of our record. The client doesn't want to receive the primary key. They want a GUID. So, we create them a GUID. However, they expect to send that query as a record recognition back to us when required. So, the simplest approach would be to add a GUID ID field in our table. But, is that really necessary? Just because of that, I'll end up with two primary key fields, one a GUID just for that. Isn't there a way to have the GUID generated based on a primary key value and degenerate it, when such a request will be launched, in order to recognize our primary key value?

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform