Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSregister_all_trans_pull_subscriptions

  No additional text.


Syntax

CREATE PROCEDURE sys.sp_MSregister_all_trans_pull_subscriptions AS
begin
    set nocount on
    declare @publisher sysname
    declare @publisher_db sysname
    declare @publication sysname
    declare @distributor sysname
    declare @subscription_id uniqueidentifier
    declare @subscription_type_id int
    declare @update_mode int
    declare @independent_agent_id int
    declare @failover_mode_id int
    declare @retcode int
    declare @dbname sysname

    if object_id(N'dbo.MSreplication_subscriptions', 'U') is NULL
        or object_id(N'dbo.MSsubscription_properties', 'U') is NULL
    begin
        return 0
    end

    select @dbname = db_name()

    -- Register all trans pull subscription
    DECLARE #current_sub CURSOR LOCAL FAST_FORWARD FOR
        select rs.publisher,rs.publisher_db,rs.publication,sp.distributor,
                rs.update_mode,rs.subscription_type,rs.independent_agent
        from MSreplication_subscriptions rs
        left outer join MSsubscription_properties sp
            on (UPPER(rs.publisher) = UPPER(sp.publisher) and rs.publisher_db = sp.publisher_db and rs.publication = sp.publication)
        where rs.subscription_type <> 0 and sp.enabled_for_syncmgr <> 1

    FOR READ ONLY
    open #current_sub
    fetch #current_sub into @publisher, @publisher_db,@publication,@distributor,@update_mode,@subscription_type_id,@independent_agent_id
    while ( @@fetch_status <> -1 )
    begin

        select @subscription_id = newid()

        if @update_mode in (3,5)
            select @failover_mode_id = 1
        else if @update_mode in (2,4)
            select @failover_mode_id = 2
        else
            select @failover_mode_id = 0

        exec @retcode = sys.sp_MSregistersubscription @replication_type = 1,
                                        @publisher = @publisher,
                                        @publisher_db = @publisher_db,
                                        @publication = @publication,
                                        @subscriber = @@servername,
                                        @subscriber_db = @dbname,
                                        @subscriber_security_mode = 1,
                                        @distributor = @distributor,
                                        @distributor_security_mode = 1,
                                        @subscription_id = @subscription_id,
                                        @independent_agent = @independent_agent_id,
                                        @subscription_type = @subscription_type_id,
                                        @failover_mode = @failover_mode_id

        IF @@ERROR <> 0 or @retcode <> 0
            return 1

        fetch next from #current_sub into @publisher, @publisher_db,@publication,@distributor,@update_mode,@subscription_type_id,@independent_agent_id

    end

    close #current_sub
    deallocate #current_sub

    return 0
end

 
Last revision 2008RTM
See also

  sp_vupgrade_express_edition (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