Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSDropCanClearSubscriberStatus

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_MSDropCanClearSubscriberStatus
(
	@publisher sysname,
	@distributor sysname,	
	@subscriber sysname,
	@distribdb sysname
)
AS
BEGIN
    DECLARE @distproc			nvarchar(1000)

    -- If the subscriber to be dropped is to a SQL Server publisher, check to see whether
	-- it is also a subscriber to an Oracle publisher serviced by this distributor.
	-- Similarly, if the subscriber to be dropped is to an Oracle publisher, check to see
	-- whether it is also a subscriber of the local publisher or a different Oracle publisher.
	-- If either condition is true, the subscriber status bit cannot be cleared when the
	-- subscriber is dropped.
	
	-- Note that the existence of remote SQL Server publishers for the subscriber does
	-- not affect whether the subscriber status bit in srvstatus of sysservers can be cleared.
	
	-- Note also that if errors are encountered in determining whether the srvstatus bit
	-- can be cleared, the result is to allow the bit to be cleared.

    BEGIN

		BEGIN TRY
			IF UPPER(@publisher) = UPPER(@distributor)
			BEGIN
				-- If the distributor and publisher are local, verify that the subscriber is not
				-- also a subscriber to a heterogeneous publisher associated with this distributor.
				SELECT @distproc = 'IF NOT EXISTS (SELECT * ' +
					'FROM ' + QUOTENAME(RTRIM(@distribdb)) + '.dbo.MSsubscriber_info i, ' +
					'msdb.dbo.MSdistpublishers s ' +
					'WHERE UPPER(i.publisher) <> UPPER(' + QUOTENAME(@publisher,'''') + ') ' +
					'AND   UPPER(i.subscriber) = UPPER(' + QUOTENAME(@subscriber,'''') + ') ' +
					'AND   UPPER(i.publisher) = UPPER(s.name) ' +
					'AND   UPPER(s.publisher_type) LIKE ''ORACLE%'') ' +
				'BEGIN ' +				
					'RAISERROR('''', 11, 1) ' +
				'END '
			END
			ELSE
			BEGIN
				-- If the distributor is local but the publisher is not, verify that the subscriber is
				-- not also a subscriber of the local distributor or a subscriber of a different
				-- heterogeneous publisher associated with this distributor.
				SELECT @distproc = 'IF NOT EXISTS (SELECT publisher ' +
					'FROM ' + QUOTENAME(RTRIM(@distribdb)) + '.dbo.MSsubscriber_info ' +
					'WHERE UPPER(publisher) = UPPER(' + QUOTENAME(@distributor,'''') + ') ' +
					'AND   UPPER(subscriber) = UPPER(' + QUOTENAME(@subscriber,'''') + ') ' +
					' UNION ' +
					'                         (SELECT i.publisher ' +
					'FROM ' + QUOTENAME(RTRIM(@distribdb)) + '.dbo.MSsubscriber_info i, ' +
					'msdb.dbo.MSdistpublishers s ' +
					'WHERE UPPER(i.publisher) <> UPPER(' + QUOTENAME(@publisher,'''') + ') ' +
					'AND   UPPER(i.subscriber) = UPPER(' + QUOTENAME(@subscriber,'''') + ') ' +
					'AND   UPPER(i.publisher) = UPPER(s.name) ' +
					'AND   UPPER(s.publisher_type) LIKE ''ORACLE%'')) ' +

				'BEGIN ' +				
					'RAISERROR('''', 11, 1) ' +
				'END '
			END
						
			EXEC (@distproc)
		
		END TRY
		
		BEGIN CATCH
			-- SRVSTATUS subscriber bit can be cleared on drop
			-- NOTE:  Errors executing the query will allow SRVSTATUS to be cleared.
			RETURN 1
		END CATCH

		-- SRVSTATUS bit cannot be cleared on drop
		RETURN 0
	END	
END

 
Last revision 2008RTM
See also

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