sp_addmergepushsubscription_agent (Transact-SQL)
SQL Server 2012
Adds a new agent job used to schedule synchronization of a push subscription to a merge publication. This stored procedure is executed at the Publisher on the publication database.
Security Note
|
|---|
|
When configuring a Publisher with a remote Distributor, the values supplied for all parameters, including job_login and job_password, are sent to the Distributor as plain text. You should encrypt the connection between the Publisher and its remote Distributor before executing this stored procedure. For more information, see Enable Encrypted Connections to the Database Engine (SQL Server Configuration Manager). |
sp_addmergepushsubscription_agent [ @publication =] 'publication'
[ , [ @subscriber = ] 'subscriber' ]
[ , [ @subscriber_db = ] 'subscriber_db' ]
[ , [ @subscriber_security_mode = ] subscriber_security_mode ]
[ , [ @subscriber_login = ] 'subscriber_login' ]
[ , [ @subscriber_password = ] 'subscriber_password' ]
[ , [ @publisher_security_mode = ] publisher_security_mode ]
[ , [ @publisher_login = ] 'publisher_login' ]
[ , [ @publisher_password = ] 'publisher_password' ]
[ , [ @job_login = ] 'job_login' ]
[ , [ @job_password = ] 'job_password' ]
[ , [ @job_name = ] 'job_name' ]
[ , [ @frequency_type = ] frequency_type ]
[ , [ @frequency_interval = ] frequency_interval ]
[ , [ @frequency_relative_interval = ] frequency_relative_interval ]
[ , [ @frequency_recurrence_factor = ] frequency_recurrence_factor ]
[ , [ @frequency_subday = ] frequency_subday ]
[ , [ @frequency_subday_interval = ] frequency_subday_interval ]
[ , [ @active_start_time_of_day = ] active_start_time_of_day ]
[ , [ @active_end_time_of_day = ] active_end_time_of_day ]
[ , [ @active_start_date = ] active_start_date ]
[ , [ @active_end_date = ] active_end_date ]
[ , [ @enabled_for_syncmgr = ] 'enabled_for_syncmgr' ]
sp_addmergepushsubscription_agent is used in merge replication and uses functionality similar to sp_addpushsubscription_agent.
-- This script uses sqlcmd scripting variables. They are in the form -- $(MyVariable). For information about how to use scripting variables -- on the command line and in SQL Server Management Studio, see the -- "Executing Replication Scripts" section in the topic -- "Programming Replication Using System Stored Procedures". DECLARE @publication AS sysname; DECLARE @subscriber AS sysname; DECLARE @subscriptionDB AS sysname; DECLARE @hostname AS sysname; SET @publication = N'AdvWorksSalesOrdersMerge'; SET @subscriber = $(SubServer); SET @subscriptionDB = N'AdventureWorksReplica'; SET @hostname = N'adventure-works\david8' -- Add a push subscription to a merge publication. USE [AdventureWorks2012]; EXEC sp_addmergesubscription @publication = @publication, @subscriber = @subscriber, @subscriber_db = @subscriptionDB, @subscription_type = N'push', @hostname = @hostname; --Add an agent job to synchronize the push subscription. EXEC sp_addmergepushsubscription_agent @publication = @publication, @subscriber = @subscriber, @subscriber_db = @subscriptionDB, @job_login = $(Login), @job_password = $(Password); GO
Security Note