Sql-server – Merge Replication – Merge initial data contained on subscriber

merge-replicationsql-server-2008-r2

I have two identically structured databases on two separate servers. Both have different data within them.

I have set one of them up with merge replication as a publisher and I want the other to be a subscriber.

The problem is that when I create the subscription, the publisher sends its snapshot to the subscriber and it clears all of the data from the subscriber database before it begins the sync process.

How can I preserve the data in both databases and set them up so that one is the publisher and the other is the subscriber?

Best Answer

You will need to manually merge the existing databases and initialize from that source.

One challenge you might face in manually merging the databases is conflicting primary keys. If so, this is typically handled by adding a location-specific identifier column and extending the primary key to include this column. This is known as partitioning your data.