Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to generate PK on SQL table
Message
 
 
À
05/01/2001 08:45:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00459598
Message ID:
00459760
Vues:
31
>>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.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform