Showing posts with label subscriber. Show all posts
Showing posts with label subscriber. Show all posts

Sunday, March 11, 2012

Dynamic Filtering

I want to dynamically filter my published data to many subscribers based
on a number contained within the server name of the subscriber. ie one
subscriber server is called 8364-Server and I want to use the 8364 as
the "club code" to extract the subset from the publisher. I preferably
want to use push subscriptions.
Using host_name just seems to return the name of the publisher which is
no good. Is my only option to use a look-up table on the publisher to
map usernames of all the subscribers to club codes?
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
use a pull subscription to get the hostname parameter to resolve to the name
of the subscriber.
If you are using merge replication you can use the HostName parameter on you
merge agent commands for this.
You would have to use left(host_name(), 4) for this to work in your filter
in the pull subscription.
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Martin Bancroft" <martin.bancroft@.galagroup.co.uk> wrote in message
news:egYD3AIeEHA.2520@.TK2MSFTNGP12.phx.gbl...
> I want to dynamically filter my published data to many subscribers based
> on a number contained within the server name of the subscriber. ie one
> subscriber server is called 8364-Server and I want to use the 8364 as
> the "club code" to extract the subset from the publisher. I preferably
> want to use push subscriptions.
> Using host_name just seems to return the name of the publisher which is
> no good. Is my only option to use a look-up table on the publisher to
> map usernames of all the subscribers to club codes?
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!

Dynamic Filtering

Hi,
I have one publisher and two subscribers, i want to filter the data
dynamiclly before sending it to the subscriber(s), my question is, how to
know the current subscriber when the merge agent implement the filtering
criteria, i tried to use Host_Name() function to know the current subscriber
but it returns the value of the publisher.
If you have any idea(s) or alternative way or any additional configuration i
have to do for this, please let answer me ASAP
Thanks in Advance.
HOST_NAME() should work fine with pull subscriptions. Anyway whether push or
pull, you can use -HOSTNAME value in the merge agent's job commandline to
override the returned value. Often you want to filter on something that has
more relevance to the business this way. For an image of setting the
HOSTNAME take a look at the article on www.replicationanswers.com/articles.
It relates to SQL 2005 but the job image is still relevant.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thanks Paul,
I've set the HOST_NAME() property for each subscriber merge agent to be its
host name and then worked fine and the data being filtered between servers as
i want.
Thanks again
"Paul Ibison" wrote:

> HOST_NAME() should work fine with pull subscriptions. Anyway whether push or
> pull, you can use -HOSTNAME value in the merge agent's job commandline to
> override the returned value. Often you want to filter on something that has
> more relevance to the business this way. For an image of setting the
> HOSTNAME take a look at the article on www.replicationanswers.com/articles.
> It relates to SQL 2005 but the job image is still relevant.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>