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)
 Replication erroring due to foreign key constraint

Author  Topic 

egossett
Starting Member

2 Posts

Posted - 2006-08-29 : 01:04:49
I am using the replication wizard to set up replication on a database. The distribution agent is erroring out with the following error:

There are no primary or candidate keys in the referenced table 'primarytable' that match the referencing column list in the foreign key 'foreign key'.

There is no scripting that is removing any keys, but the keys in the primary table do seem to be missing in the replicated database (except the primary). I tried manually adding and restarted the agent, but it failed again and when I checked the primary table, the key is missing again.

Please help and let me know what info you need...

Thanks,
Ria

egossett
Starting Member

2 Posts

Posted - 2006-08-30 : 15:02:35
New information...in checking the article defaults for the publisher, copying over non-clustered indexes is not checked. I tried rebuilding it and making sure it was checked and when it is finished and I go into properties, it is unchecked. I also tried changing it in properties and "applying" and when I go back in it is unchecked again.

I believe this means that my non-clustered indexes are not being built. How do I get this setting to stay?

Thanks,
Ria

Erika Gossett
Go to Top of Page

Rishi Maini SQL2K5 Admin
Yak Posting Veteran

80 Posts

Posted - 2006-08-31 : 05:30:35
I do not think that Non-Clustered Index should bother Replication.
By Defualt for a Table the referential constraints plus the Idexes are copied . So make sure that in the Article Properties , under the Snapshot Tag you have these Checkboxes enabled for you.

Drop the Existing table and re-create it
|
|_______ a.) Include declared referential integrity
b.) Clustered indexes
c.) Nonclustered indexes
d.) User triggers

( Note to make any changes here you need to re-initialize your Subscribers. )

Thanks
Rishi Maini
Go to Top of Page
   

- Advertisement -