Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Transactioanl Replication- IDENTITY Field

Author  Topic 

ckuo@kahluadesigns.com
Yak Posting Veteran

58 Posts

Posted - 2003-03-15 : 16:02:59
I have my subscriber tables' IDENTITY fields set to Yes( NOT FOR REPLICATION ). Also, on these article tables, I have not to Create SP when initializing the snapshot and to KEEP the existing tables untouched. But when the replicaton runs, I get this error:

Violation of PRIMARY KEY constraint 'PK_ProductOptions_1'. Cannot insert duplicate key in object 'ProductOptions'.

Is there anything else I'm doing wrong? Thanks

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2003-03-17 : 02:42:50
Let me clear about NOT FOR REPLICATION OPTION first, if you have a table A with identity set to (1,1) then on insertion of 3 rows the maximum identity will be 3 and now on replication of a new row is inserted from table B which has identity column of 100. The table A will not reseed the identity value here. So the next inserted row will have identity value on table A will be 4. If the option is not given then the next inserted row will have identity value on table A be 101.

NOT FOR REPLICATION OPTION is especially useful in Transactional Replication & Merge Replication. Try with the option drop and recreate the table at subscriber


Sekar
~~~~
Success is not a destination that you ever reach. Success is the quality of your journey.
Go to Top of Page
   

- Advertisement -