Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSadd_subserver

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_MSadd_subserver
(
	@subscriber sysname,
	@type		int
)
WITH EXECUTE AS 'dbo'
AS
BEGIN
	DECLARE @retcode 			int,
			@dsn_subscriber 	tinyint,
			@jet_subscriber 	tinyint,
			@oledb_subscriber 	tinyint,
			@srvid				smallint

    -- Defined in sqlrepl.h
	select @dsn_subscriber = 1,
			@jet_subscriber = 2,
			@oledb_subscriber = 3,
			@srvid = NULL

	/*
	** The server may already be listed in master.dbo.sysservers, but might
	** not be marked as a subscriber yet.  If it's not in
	** master.dbo.sysservers, let's add it first.
	*/
	IF NOT EXISTS (SELECT *
	                     FROM master.dbo.sysservers
	                    WHERE LOWER(srvname collate database_default) = LOWER(@subscriber) collate database_default)
	BEGIN
		SELECT @subscriber = UPPER(@subscriber)
		EXECUTE @retcode = sys.sp_addserver @subscriber
		IF @@error <> 0 OR @retcode <> 0
		BEGIN
			-- Could not create Subscriber.
			RAISERROR (14042, 16, -1)
			RETURN 1
		END
	END
	SELECT @subscriber = sys.fn_getpersistedservernamecasevariation(@subscriber) collate database_default

	/*
	** Set the server option to indicate this is a subscriber.
	*/

	EXECUTE @retcode = sys.sp_serveroption @subscriber, 'sub', true

	IF @@error <> 0 OR @retcode <> 0
	BEGIN
		RAISERROR (14042, 16, -1)
		RETURN 1
	END
	
	/*
	** Set the server option to indicate this is a DSN subscriber.
	*/
	IF @type = @dsn_subscriber OR @type = @jet_subscriber OR @type = @oledb_subscriber
	BEGIN
		exec @retcode = sys.sp_serveroption @server = @subscriber,
											@optname = 'nonsqlsub',
											@optvalue =  'on'
		IF @@error <> 0 or @retcode <> 0
		BEGIN
			-- Unable to mark sysservers entry '%s' as a non SQL Server subscriber.
			RAISERROR (14011, 16, -1, @subscriber)
			RETURN 1
		END		
	END

END

 
Last revision 2008RTM
See also

  sp_addmergesubscription (Procedure)
sp_MSdrop_replcom (Procedure)
sp_MSrepl_addsubscriber (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