>>I understand there are potential problems using Identity fields in SQL to generate a PK.
>>
>>1. Trying to return value with @@identity may give value for insert on another table
>>2. Problems with replication
>>
>>What is the best way to get around these problems? Does SQL 2000 have something to help get around #1? We plan to use replication in the future, should we use GUIDs from the beginning and forget identity fields?
>>
>>Thanks.
>>Doug
>
>#1 is false
Ken,
What do mean #1 is false? #1 presents itself if you have insert triggers on your tables that insert into tables with identity fields. By the time you attempt to retrieve the new indentity value, it has already been reset from the initial table to that of the "child" table.
What you may be referring to is @@identity is unique to each connection. So someone else making inserts at the same time as you won't interfere.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao