Groups | Blog | Home
all groups > sql server replication > july 2007 >

sql server replication : Unwanted delete!



Leila
7/21/2007 12:00:00 AM
Hi,
I have replication between two instances of SQL2K. I have created the
subscription with choosing option of "do not initialize schema and data...".
Imagine I have Customers and Orders table in publisher and subscriber that
CustomerID from orders references CustomerID in customers. Both publisher
and subscriber have their own data, therefore some customers exist in
publisher that subscriber doesn't have them and vice versa. When subscriber
inserts an order for a customer which exists only in subscriber, this new
order will be replicated to publisher as well but whereas its customer is
not there, the insert encounters the violation of FK constraint. Everything
is ok so far. The bad thing is that this new order will be deleted from the
subscriber although its customer is available there. How can I prevent this
final delete?
Any help would be greatly appreciated?
Leila


Hilary Cotter
7/23/2007 12:00:00 AM
Set up your DRI on the publisher and subscriber with the not for replication
clause.

Then set compensate for errors to be false.

--
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]

Leila
7/24/2007 12:13:44 AM
That was great help! Thanks indeed :)


[quoted text, click to view]

AddThis Social Bookmark Button