>I use surrogate primary keys in VFP also. Identity column are just an easy way to auto number the next row inserted. But they do present a few problems as does just about any way that you try to id the next row.
>
>The old standby method of keeping a table of next ids has its problems also, i.e., you get the last number, add one to it, just as someone inserts a row and a new number before I save mine.
>
>The difficult part of identity columns, and I haven't come up with a satisfactory method, is when their used as foreign keys and they must be updated at the same time as the parent. As in invoice header and invoice details. You would want to handle it all in a transaction, updating the invoice header then the details.
>
>Maybe Michael Levy can give us an elegant way.
I had a reply in the VFP Forum from Trey Walpole who suggested using GUIDs - Globally Unique Identifiers. I have read they are good for distributed and replicated data. He gave me a link to a MS page some code to generate GUIDs with VFP. This seems like a good idea, but I am concerned about performance:
1. Time to generate a GUID
2. GUID are 16 bytes, I believe
Chris McCandless
Red Sky Software