all groups > sql server replication > july 2005 >
You're in the

sql server replication

group:

NOT FOR REPLICATION



NOT FOR REPLICATION Ed
7/28/2005 11:21:03 AM
sql server replication: hi,
Could anyone explain to me under the relationship property, what is the
meaning of "Enforce relationship for replication"?
I understand that the "Not for Replication" in Trigger is that the trigger
won't get fired off if the data is Insert/Update/Delete during the
replication process.

I cannot figure out what is the "Enforce relationship for replication" and
how it will affect the replication process????

Thanks
Re: NOT FOR REPLICATION Ed
7/28/2005 8:26:10 PM
Thanks for your detailed answer. I am still confused. I have been
implementing the transational replication and I just leave the Not for
Replication checked and I don't see any issue so far... I am still wondering
how can I test the situation see the difference...

[quoted text, click to view]
Re: NOT FOR REPLICATION Hilary Cotter
7/28/2005 8:41:03 PM
this is a very complex question and has different meaning for different
replication types.

Basically transactional replication replicates transactions transactionally.

So if you delete a row in a parent table and have cascading updates and
enforce the relationship for replication the delete on the parent will be
replicated to the subscriber. The cascading deletes will be kicked off on
the publisher and the corresponding child records will be deleted. With the
enforce the relationship for replication the cascading delete will occur on
the subscriber child rows. If you are replicating the child table, the
deletes will not be replicated. If you have unchecked the enforce the
relationship for replication the cascading deletes on the child will be
replicated.

The cascading deletes will be done in the same transactional context on the
publisher, and in another transactional context on the subscriber.

Now I can hear you shaking your head and asking yourself, why would I want
to uncheck this option. You may have before or after triggers, or your
stored procedures may have business logic where you want the cascading
deletes handled in a different manner, or if you don't have cascading
deletes on the subscriber, you will want the child deletes to be replicated.

The same holds true for cascading updates.

Now for merge its a whole different ball game. Basically in merge you want
to send as little data to the subscriber or vice versa to the publisher as
possible. So you horizontally filter your tables using filters, including
join filters which walk the DRI. So if a parent record is part of the
filter, and you have join filters, the child records might also be. If you
enforce the relationship for replication only the parent update/delete will
be merged. The corresponding cascading update/delete will occur on the other
end during the synchronization. Again you may have different constraints,
triggers on the other side, or you find that the parent and child record are
not replicated in order and may get agent failure. Un-checking this option
will mitigate this behavior.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com

[quoted text, click to view]

Re: NOT FOR REPLICATION Paul Ibison
7/28/2005 10:06:51 PM
Ed,
mostly it isn't necessary, but this article will explain a few cases where
it is...:
http://www.replicationanswers.com/MergeProcessingOrderArticle.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

AddThis Social Bookmark Button