imak
imak

Reputation: 6699

drop a foreign key constraint for replicated table

Can I drop a foreign key contraint from a table participating in merge replication? If so, can i just drop it from the published and will this chnage be replicated to all subscribes?

Upvotes: 2

Views: 3809

Answers (3)

SAKA UK
SAKA UK

Reputation: 39

I have solved this by changing the articles properties on the publication to truncate the data instead of dropping and recreating the tables.

U need to generate a new snapshot after doing that.

Cheers

Upvotes: 0

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239754

There's a dedicated article on MSDN around Making Schema Changes on Publication Databases

It does obliquely discuss the dropping of constraints, here:

It is recommended that constraints be explicitly named. If a constraint is not explicitly named, SQL Server generates a name for the constraint, and these names will be different on the Publisher and each Subscriber. This can cause issues during the replication of schema changes. For example, if you drop a column at the Publisher and a dependent constraint is dropped, replication will attempt to drop the constraint at the Subscriber. The drop at the Subscriber will fail because the name of the constraint is different. If synchronization fails because of a constraint naming issue, manually drop the constraint at the Subscriber and then rerun the Merge Agent.

Upvotes: 2

Related Questions