Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSmergepushsubscriptionagentjobcontrol

  No additional text.


Syntax
create procedure sys.sp_MSmergepushsubscriptionagentjobcontrol
(
    @publication    sysname,
    @subscriber     sysname,
    @subscriber_db  sysname,
    @action         tinyint
)
as
begin
    set nocount on

    declare @PUSH int

    set @PUSH = 0

    declare @retcode            int
    declare @distributor_rpc    sysname
    declare @distributor        sysname
    declare @distribution_db    sysname
    declare @pubid              uniqueidentifier
    declare @procedure          nvarchar(4000)
    declare @publisher          sysname
    declare @publisher_db       sysname
    declare @start              tinyint

    set @publisher = publishingservername()
    set @publisher_db = db_name()
    set @retcode = 0
    set @start = 0

    -- Security check
    exec @retcode = sys.sp_MSreplcheck_publish
    if @@error <> 0 or @retcode <> 0
        return 1

    -- Make sure current database is enabled for merge replication
    exec @retcode = sys.sp_MSCheckmergereplication
    if @@error <> 0 or @retcode <> 0
        return 1

    -- Parameter check: @subscriber
    if @subscriber is null
    begin
        declare @originating_procedure sysname
        if @action = @start
            set @originating_procedure = 'sp_startmergepushsubscription_agent'
        else
            set @originating_procedure = 'sp_stopmergepushsubscription_agent'

        -- "The parameter @subscriber cannot be NULL."
        raiserror (14043, 16, -1, '@subscriber', @originating_procedure)
        return 1
    end

    select @pubid = pubid
      from dbo.sysmergepublications
     where upper(publisher)=upper(@publisher)
       and publisher_db=@publisher_db
       and name = @publication
    if @pubid is null
    begin
        -- The publication '@publication' does not exist.
        raiserror (20026, 16, -1, @publication)
        return 1
    end

    if not exists (select *
                    from dbo.sysmergesubscriptions
                   where upper(subscriber_server) = upper(@subscriber)
                     and db_name = @subscriber_db
                     and pubid = @pubid
                     and subscription_type = @PUSH)
    begin
        -- "The subscription could not be found."
        raiserror (20021, 16, -1)
        return 1
    end

    exec @retcode = sys.sp_helpdistributor
                @rpcsrvname = @distributor_rpc output,
                @distribdb = @distribution_db output
    if @@error <> 0 or @retcode <> 0 or @distribution_db is null
    begin
        -- "The Distributor has not been installed correctly."
        raiserror (20036, 16, -1)
        return 1
    end

    set @procedure = quotename(rtrim(@distributor_rpc)) + '.' + quotename(rtrim(@distribution_db)) + case when @action = @start then '.sys.sp_MSstartmerge_agent' else '.sys.sp_MSstopmerge_agent' end
    exec @retcode = @procedure
            @publisher = @publisher,
            @publisher_db = @publisher_db,
            @publication = @publication,
            @subscriber = @subscriber,
            @subscriber_db = @subscriber_db
    return @retcode
end

 
Last revision 2008RTM
See also

  sp_MSdrop_replcom (Procedure)
sp_startmergepushsubscription_agent (Procedure)
sp_stopmergepushsubscription_agent (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash