After a lot of searches, reading a few articles and trying couple of suggested solutions, I am still unable to successfully set up a bi-directional transactional replication for SQL Server.
I have created two databases - test1 and test2.
Each of these two databases has a table name table1 with two columns - ID
and MESSAGE
.
ID
is the primary key, an int IDENTITY, NOT FOR REPLICATION.
For test1, the IDENTITY is defined as IDENTITY (1,2).
For test2, the IDENTITY is defined as IDENTITY (2,2).
Basically the odd-even rule so that the replicated data do't conflict.
But the problem is, when I create the publications and subscriptions on both the databases and execute the jobs, the jobs fail with the message saying that it couldn't delete table1 because it is used for replication.
So I guess, test2 is receiving an initial snapshot of test1, and it is trying to delete table1. And vice versa.
How then, I am going to create a bi-directional replication?