Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary Key and replication
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Réplication
Divers
Thread ID:
00890561
Message ID:
00891589
Vues:
30
Marcus,

>What would you recommend to use as primary key data type?
>
>Is it possible to use a INT ID field or must we use GUIDs.

Merge replication requires that each table has a GUID field marked as the ROWGUID for the table with a default value of newid(). If you don't have one with those specifications, when you set up the publication SQL Server will add such a field. This row does not need to be the primary key on the table, but in most cases you'll probably want to save yourself some trouble and have that as your Primary key. You're going to run into problems creating unique ids in two locations with anything other than GUID as a PK.

The exception to this might be some lookup tables or such where you might not want a GUID as the PK, even though they're still going to need on for replication. You could probably get away with setting up some compound primary key based on a location field +something else, with different default values for the "location" at each server. Or maybe you can specify different ranges for an auto-incrimenting field.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform