Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSset_sub_guid

  No additional text.


Syntax
create procedure sys.sp_MSset_sub_guid (
    @publisher      sysname,                    -- publishing server name
    @publisher_db   sysname,                    -- publishing database name. If NULL then same as current db
    @publication    sysname,                    -- publication name,
    @subscription_type int,
    @subscription_guid binary(16),
    @queue_id        sysname,
    @queue_server    sysname = NULL
)
AS
BEGIN
    set nocount on
    declare @retcode int
                ,@independent_agent bit
                ,@subqueue_id sysname

    --  Security Check
    EXEC @retcode = sys.sp_MSreplcheck_subscribe
    IF @@ERROR <> 0 or @retcode <> 0
        RETURN(1)

    -- For non independent agent publications
    if @publication is null or @publication = ''
    begin
        select @publication = 'ALL'
                ,@independent_agent = 0
    end
    else
        select @independent_agent = 1

    if @queue_id = N''
        select @queue_id = NULL

    if @queue_server = N''
        select @queue_server = NULL
    
    -- Special processing when we are dealing with pull SQL queue updating subscription
    
    if ((@subscription_type = 1) and substring(@queue_id, 1, 10) = N'mssqlqueue')
    begin
        
        -- For SQL Queue case - Check the current queue_id on the table
        
        select @subqueue_id = queue_id
        from dbo.MSsubscription_agents
        where UPPER(publisher) = UPPER(@publisher)
            and publisher_db =  @publisher_db
            and publication = @publication
            and subscription_type = @subscription_type
        if (@subqueue_id is not NULL and substring(@subqueue_id, 1, 10) = N'mssqlqueue')
        begin
            
            -- Use the local Queue ID on subscriber as this contains the queue version.
            -- We are attaching an initialized subscription and do not want to change the
            -- queue version stored in queue_id for SQL Queues. The value passed by Distribution
            -- Agent is from the distributor metadata and does not contain the queue version information.
            -- This is specific to SQL Queues only.
            
            select @queue_id = @subqueue_id
        end
    end
    
    -- Update metadata in MSsubscription_agents
    
    update MSsubscription_agents set
        queue_id = @queue_id
        ,queue_server = @queue_server
    where UPPER(publisher) = UPPER(@publisher)
    and publisher_db =  @publisher_db
    and publication = @publication
    and subscription_type = @subscription_type

    update MSreplication_subscriptions set
        [time] = getdate(),
        subscription_guid = @subscription_guid
    where UPPER(publisher) = UPPER(@publisher)
        and publisher_db =  @publisher_db
        and (@independent_agent = 0 or publication = @publication)
        and subscription_type = @subscription_type
        and independent_agent = @independent_agent
END

 
Last revision 2008RTM
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