all groups > sql server replication > june 2005 >
You're in the

sql server replication

group:

Using HOST_NAME() in dynamic Filters for Merge replication


Using HOST_NAME() in dynamic Filters for Merge replication Michael Buck
6/14/2005 12:34:41 AM
sql server replication:
Hi all...

While setting up my merge replication through the replication wizard in I
read that the use of HOST_NAME() in the dynamic filter returns the
Subscriber's Machine Name. However the only thing that ever matches and
causes replication of the data to fire is the Machine Name of the
Publisher/Distributor. I wish to push only filtered data that is linked to
my stores table, and only specific to each particular site. Is there
another built-in function that will give me the Subscriber's Machine name so
I can match it to a field in my stores table?

Re: Using HOST_NAME() in dynamic Filters for Merge replication Paul Ibison
6/14/2005 9:04:36 AM
Michael,
you can use pull subscriptions, or alternatively override the computername
value using -HOSTNAME as a parameter in the merge agent's job.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Re: Using HOST_NAME() in dynamic Filters for Merge replication Michael Buck
6/14/2005 9:08:36 PM


Is there a dynamic filter function that will give me the name of the
machine that is the recipient/subscriber of the push from the Central
Database?

Thanks for the reference book link, but I already have that one on order
but have not recieved it yet !!

Re: Using HOST_NAME() in dynamic Filters for Merge replication Paul Ibison
6/15/2005 12:00:00 AM
AFAIR it is the login of the sql server agent, rather than the user logged
in. The -HOSTNAME parameter would seem to be OK.
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Re: Using HOST_NAME() in dynamic Filters for Merge replication buck
6/15/2005 9:09:40 AM
My bad....I did not give you enough information. There are multiple
remote DBs, not just one. However I do it, it needs to be flexible
enough to only push the information that is linked via FKs to the proper
remote machine's DB. Could this be done by setting the replication
login name of each remote, adding these logins to the central DB and
filtering on SUSER_SNAME()instead of HOST_NAME()? Does this function
return the login that the subscriber is using or something else?


Re: Using HOST_NAME() in dynamic Filters for Merge replication Paul Ibison
6/15/2005 9:12:49 AM
The answer's in my previous post :) What you can do is create the filter as
per usual using HOST_NAME() in the where clause of the publication wizard.
This will resolve to the computername of your publisher\distributor which is
not what you want. However, this is overridden by hardcoding the desired
value in the merge agent's parameters: -HOSTNAME xxx. This is particularly
useful, as the filtering usually isn't based on the computername, but on
some other business information.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

AddThis Social Bookmark Button