Hi Kamil,
You don't have to implement the same strategy for SQL Server or Oracle. SQL Server allows you to have integer Identity fields which are handled by the database automatically or uniqueidentifiers, which are GUIDs with a different name. Oracle has sequences, which are also integer values managed from system sequence tables, again -- internally.
In both cases, you don't have to worry about the process of generating primary keys.
>
>I intend to introduce a mandatory Primary Key
>column in almost all my tables. For this perpose i
>am considering using the result of CoCreateGuid()
>API call which is a 16 byte C structure representing
>a GUID. I plan to treat the structure as a string and
>store it in a column of PK C(16) NOCPTRANS. I hope
>with VFP tables it will play out well. What i am
>uncertain about is how to implement this scheme on
>SQL servers, particularly on Oracle and MS SQL servers.
>Could you eluminate me on this?
>
>Thank you.
>Kamil.
>
>
>>Hey Walter,
>>
>>I have to go back to an earlier point in another (or the same?) thread:
>>
>>Surrogate keys are the absolute best way to guarantee a unique primary key bar none. Period. And, IMHO, the CoCreateGUID API call absolutely guarantees uniqueness spanning not only the table, but the database, the machine, the network, the freaking
world.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05