Am I correct to assume that the Host_Name function, when used in a filter
expression at the publisher will return the subsriber host name?
What does SUSER_SNAME return:
The name of the current logged on user at the subscriber?
The name of the SQL server run account ath the subsciber?
Or the SQLServerAgent run account at the subscriber?
Tony Toker
Data Identic Ltd.
That depends. If it is a pull subscription, which means the agent is running
on the subscriber it will return the name of the subscriber. If it is a push
subscription, which means the agent is running on the publisher it will
return the name of the publisher.
Unless of course we are talking merge replication and you override this
behavior by using the HostName parameter in the merge agent commands
section. (right click on your merge agent, select agent propertes, Steps,
run agent, click edit, and in the command section look or add a -HostName
and then enter the name you wish to be replaced by the HostName parameter
here.
SUser_SName will resolve to account that the SQL Server agent runs under.
For a push, its the SQL Server agent account on the publisher, for a pull
the SQL Server agent account on the Subscriber.
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Tony Toker" <xxxx@.xxxx.com> wrote in message
news:celd7r$n8l$1$830fa7b3@.news.demon.co.uk...
> Am I correct to assume that the Host_Name function, when used in a filter
> expression at the publisher will return the subsriber host name?
> What does SUSER_SNAME return:
> The name of the current logged on user at the subscriber?
> The name of the SQL server run account ath the subsciber?
> Or the SQLServerAgent run account at the subscriber?
> Tony Toker
> Data Identic Ltd.
>
|||<mini-quibble>
"SUser_SName will resolve to account that the SQL Server agent runs under.
For a push, its the SQL Server agent account on the publisher, for a pull
the SQL Server agent account on the Subscriber."
The Merge Agent typically runs under SQL Server Agent at the Distributor for
push subscriptions (not the publisher) or at the Subscriber for pull
subscriptions.
</mini-quibble>
Regards,
Paul Ibison
|||That is correct. Thanks for the correction.
Keep in mind that for most topologies - the publisher will be on the same
server as the distributor.
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:uM%23AusJeEHA.1000@.TK2MSFTNGP12.phx.gbl...
> <mini-quibble>
> "SUser_SName will resolve to account that the SQL Server agent runs under.
> For a push, its the SQL Server agent account on the publisher, for a pull
> the SQL Server agent account on the Subscriber."
> The Merge Agent typically runs under SQL Server Agent at the Distributor
for
> push subscriptions (not the publisher) or at the Subscriber for pull
> subscriptions.
> </mini-quibble>
> Regards,
> Paul Ibison
>
Showing posts with label publisher. Show all posts
Showing posts with label publisher. Show all posts
Sunday, March 11, 2012
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)
>
>
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)
>
>
Labels:
database,
datadynamiclly,
dynamic,
filter,
filtering,
microsoft,
mysql,
oracle,
publisher,
sending,
server,
sql,
subscriber,
subscribers,
toknow
dynamic filter - mobile device
Hi,
I am using mobile devices as subscribers and a desktop as a publisher.
If i want to use dynamic filters, do I really have to use host_name?
If the mobile devices have a web service method called ReturnId() that
returns the unique id that identifies the mobile device and the id can be
verified against the database that is being synchronised,
is it possible to do dynamic filters based on this webservice method?
Thank you.
-HOSTNAME can be used as a parameter to the merge agent and a value hardcoded
there. If the value returned from the webservice never changes then it could
be read when creating the subscription and used to define the merge agent's
job.
HTH,
Paul Ibison
|||Hi,
I am terribly sorry but I do not quite understand.
I saw your suggested solution in another web page
http://www.replicationanswers.com/Merge.asp
I was wondering if this Host_Name() is a function that will return the
computer name of the device/desktop that the subscriber database is residing
on?
If I am using mobile devices as subscribers and they have a web service
method called Reader_Id() which returns the unique id of the mobile device,
how do I modify your solution accordingly if it is at all possible?
eg, if i arbitrarily set my mobile devices with the ids: 1, 2, and 3 for 3
different devices, how can I still use those values as parameters inside your
dynamic filters?
I am a novice at this, thank you for your patience and advice.
"Paul Ibison" wrote:
> -HOSTNAME can be used as a parameter to the merge agent and a value hardcoded
> there. If the value returned from the webservice never changes then it could
> be read when creating the subscription and used to define the merge agent's
> job.
> HTH,
> Paul Ibison
>
|||I'm assuming you run the merge sync programatically on the mobile device - if
this is the case, you'll be using the "SqlCeReplication" class. This class
has a "HostName" property that can be set to the return value from your
webservice. Please let me know if this makes sense fior your case.
HTH,
Paul Ibison
I am using mobile devices as subscribers and a desktop as a publisher.
If i want to use dynamic filters, do I really have to use host_name?
If the mobile devices have a web service method called ReturnId() that
returns the unique id that identifies the mobile device and the id can be
verified against the database that is being synchronised,
is it possible to do dynamic filters based on this webservice method?
Thank you.
-HOSTNAME can be used as a parameter to the merge agent and a value hardcoded
there. If the value returned from the webservice never changes then it could
be read when creating the subscription and used to define the merge agent's
job.
HTH,
Paul Ibison
|||Hi,
I am terribly sorry but I do not quite understand.
I saw your suggested solution in another web page
http://www.replicationanswers.com/Merge.asp
I was wondering if this Host_Name() is a function that will return the
computer name of the device/desktop that the subscriber database is residing
on?
If I am using mobile devices as subscribers and they have a web service
method called Reader_Id() which returns the unique id of the mobile device,
how do I modify your solution accordingly if it is at all possible?
eg, if i arbitrarily set my mobile devices with the ids: 1, 2, and 3 for 3
different devices, how can I still use those values as parameters inside your
dynamic filters?
I am a novice at this, thank you for your patience and advice.
"Paul Ibison" wrote:
> -HOSTNAME can be used as a parameter to the merge agent and a value hardcoded
> there. If the value returned from the webservice never changes then it could
> be read when creating the subscription and used to define the merge agent's
> job.
> HTH,
> Paul Ibison
>
|||I'm assuming you run the merge sync programatically on the mobile device - if
this is the case, you'll be using the "SqlCeReplication" class. This class
has a "HostName" property that can be set to the return value from your
webservice. Please let me know if this makes sense fior your case.
HTH,
Paul Ibison
Subscribe to:
Posts (Atom)