Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_helpmergealternatepublisher

  No additional text.


Syntax
create procedure sys.sp_helpmergealternatepublisher (
	@publisher					sysname,	/* Publisher server */
	@publisher_db				sysname,	/* Publisher database */
	@publication				sysname	/* Publication name */
) AS

	SET NOCOUNT ON
	declare @subid				uniqueidentifier
	declare @pubid				uniqueidentifier
	declare @distributor		sysname
	declare @retcode			int

	declare @MShelpmergealternatepublisher TABLE
	(
		subid					uniqueidentifier	not null,
		alternate_publisher		sysname				collate database_default not null,	
		alternate_publisher_db	sysname				collate database_default not null,	
		alternate_publication	sysname				collate database_default not null,	
		alternate_distributor	sysname				collate database_default null,	
		friendly_name			nvarchar(255)		collate database_default null,	
		enabled					bit					not null
	)
	
    set @publisher= LOWER(@publisher collate SQL_Latin1_General_CP1_CS_AS)
	
	/*
	** Select the subscription's pubid and subid
	*/
	select @pubid = pubid from dbo.sysmergepublications	
				where name = @publication and
					LOWER(publisher collate SQL_Latin1_General_CP1_CS_AS) = @publisher and
					publisher_db = @publisher_db
	if @pubid is NULL
	begin
	    -- since we are adding a sysmergepublications entry for the alternate publisher
	    -- see sp_MScreateglobalreplica - the entry should be there
		raiserror (21423, 11, -1, @publication)
		return (1)
	end

	if  1 <> {fn ISPALUSER(@pubid)}
	begin
		raiserror(21423, 11, -1, @publication)
		return (1)
	end
		
    insert into @MShelpmergealternatepublisher
        (subid, alternate_publisher, alternate_publisher_db,
         alternate_publication, alternate_distributor, friendly_name, enabled)
    select distinct pub.pubid, pub.publisher, pub.publisher_db,
          pub.name, pub.distributor, alt.description, 1
    from dbo.sysmergepublications pub, dbo.MSmerge_altsyncpartners alt
    where pub.pubid = alt.alternate_subid and alt.subid = @pubid

    insert into @MShelpmergealternatepublisher
        (subid, alternate_publisher, alternate_publisher_db,
         alternate_publication, alternate_distributor, friendly_name, enabled)
    select pubid, publisher, publisher_db,
          name, distributor, description, 1
    from dbo.sysmergepublications where pubid = @pubid

    insert into @MShelpmergealternatepublisher
        (subid, alternate_publisher, alternate_publisher_db,
         alternate_publication, alternate_distributor, friendly_name, enabled)
    select distinct pub.pubid, pub.publisher, pub.publisher_db,
          pub.name, pub.distributor, sub.description, 0
    from dbo.sysmergepublications pub, dbo.sysmergesubscriptions sub
    where pub.pubid not in (select subid from dbo.MSmerge_altsyncpartners) and
          pub.pubid not in (select alternate_subid from dbo.MSmerge_altsyncpartners) and
	      pub.pubid not in (select subid from @MShelpmergealternatepublisher) and
	      sub.pubid = pub.pubid and sub.pubid = sub.subid
	
	select distinct alternate_publisher,
		alternate_publisher_db,
		alternate_publication,
		alternate_distributor,
		friendly_name,
		enabled
		from @MShelpmergealternatepublisher
	order by alternate_publisher, alternate_publisher_db, alternate_publication, alternate_distributor
	
	return (0)


 
Last revision 2008RTM
See also

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