Wednesday, March 28, 2012

Merge filtering HOST_NAME help

Hello
Im trying to create a merge replication.
I've a 2xSubscribers and a distributor/publisher
My published table has fieldnames describing what server this row should be published. When I create my replication a use a filter like this: ... where target_server = host_name()
I want to publish rows to different subscribers, for instance i have a server with hostname 'BOBAFETT' and another with hostname 'R2D2' and a distributor/publisher with hostname 'SKYWALKER'. When I insert a row into the publisher I cannot get it replicate
d unless i use SKYWALKER as target_server, but I will use BOBAFETT or R2D2 as target_server, thereby getting the correct row to the intended subscriber!!
Another strange thing, when I insert a row into the subscriber it gets deleted and nothing is inserted into the publishers table!!
My own thoughts is that the host_name() only applies to the publisher and not the subscriber, therefore im only able to publish tows with the publisher name as fieldvalue - That's not quite what I would expect.
Ohh btw. If I hardcode BOBAFETT in the filter where clause it gets the correct rows!!
Can anybody help me?
Kind regards
Janus, Denmark
Janus,
as SKYWALKER is your publication server, this should amalgamate all the rows. The other servers BOBAFETT and R2D2 will be restricted to having rows with their own server name in the filtering column ie on R2D2 you can add rows with R2D2 but you can't add
a record having the value SKYWALKER.
BTW, there is another way of setting it up which is less restrictive - you can use -HOSTNAME 'value' as a parameter in the merge agent's job. This means that you aren't restricted to having a column with R2D2 or BOBAFETT in it, and instead you could have
some business indicator.
HTH,
Paul Ibison, London, UK

No comments:

Post a Comment