Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Transactional Replication Server Acts as Publisher and Subscriber?

$
0
0

I am configuring Transactional replication. Here my scenerio is that I am configuring my Server1 Tto act as Publisher and Subscriber , Secondary Server also act as Publisher and Subsciber Now I am applying Filter on my Article in Publication1 of Server1 based on some condition and viceversa i am doing same in publication2 of Server2.

Ex : if My Article contains 4 records in Publication1 on filter condition Location='A' and 1 record in Publication2 on Filter Condition Location='B'

Publication1:

PK NAME LOCATION PK/1 RAJESH A
PK/3 RAJESH A
PK/4 RAJESH A
PK/5 RAJESH A

Publication2:

PK NAME LOCATION PK/2 RAJESH B

Resultant Should be :

Subscription1: PK NAME LOCATION PK/1 RAJESH A
PK/2 RAJESH B
PK/3 RAJESH A
PK/4 RAJESH A
PK/5 RAJESH A

Subscription2:

PK NAME LOCATION PK/1 RAJESH A
PK/2 RAJESH B
PK/3 RAJESH A
PK/4 RAJESH A
PK/5 RAJESH A

Once I will insert the record in Article Object in Publication2 of Server2 where Location='B' that should be replicated to Subscription of Server1 B
Once I will insert the record in Article Object in Publication1 of Server1 where Location='A' that should be replicated to Subscription of Server2

I am not getting the Expexted Results , Can any one have any Idea .

Kindly , Please Guide me on the same.

---- CODE------- create database A ---- SERVER 1------- USE A GO CREATE TABLE A1(PK VARCHAR(25) PRIMARY KEY,NAME CHAR(100),LOCATION CHAR(100) DEFAULT DB_NAME(0) ) INSERT INTO A1(PK,NAME) VALUES ('PK/1','RAJESH') INSERT INTO A1(PK,NAME) VALUES ('PK/3','RAJESH') INSERT INTO A1(PK,NAME) VALUES ('PK/4','RAJESH') INSERT INTO A1(PK,NAME) VALUES ('PK/5','RAJESH') SELECT * FROM A1 DELETE FROM A1 WHERE LOCATION='A'

----- SERVER 2--------- create database B USE B GO CREATE TABLE A1(PK VARCHAR(25) PRIMARY KEY,NAME CHAR(100),LOCATION CHAR(100) DEFAULT DB_NAME(0) ) INSERT INTO A1(PK,NAME) VALUES ('PK/2','RAJESH') SELECT * FROM A1 DELETE FROM A1 WHERE LOCATION='B'


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>