Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHdroppublisher

  No additional text.


Syntax


-- Name:
--          sp_IHdroppublisher

-- Description:
--          Drop HREPL publisher info

-- Security:
--          Internal
-- Requires Certificate signature for catalog access

-- Returns:
--          Success (0) or failure (1)

-- Owner:
--          

CREATE PROCEDURE sys.sp_IHdroppublisher
(
	@publisher		sysname,
	@publisher_type	sysname,
	@no_checks		bit = 0
)
AS
BEGIN
	SET NOCOUNT ON

	DECLARE @retcode int
	DECLARE @publisher_id smallint

    -- Parameter Check:  @publisher.
    -- Check to make sure that the publisher exists, that the name isn't
    -- NULL, and that the name conforms to the rules for identifiers.
    IF @publisher IS NULL
	BEGIN
		RAISERROR (14043, 16, -1, '@publisher', 'sp_IHdroppublisher')
		RETURN (1)
	END
	
	-- Param check
	-- Verfiy publisher type is valid
    IF @publisher_type NOT IN (N'MSSQLSERVER', N'ORACLE', N'ORACLE GATEWAY')
    BEGIN
        RAISERROR (21643, 16, -1, '@publisher_type')
        return (1)
    END

    EXECUTE @retcode = dbo.sp_validname @publisher

    IF @retcode <> 0
        RETURN (1)

	
	-- Look up publisher ID
	
	SELECT @publisher_id = svr.srvid
	FROM   master.dbo.sysservers svr
	JOIN   msdb.dbo.MSdistpublishers dist ON svr.srvname = dist.name
	WHERE  UPPER(dist.name collate database_default) = UPPER(@publisher) collate database_default

	IF @publisher_id IS NULL
	BEGIN
        RAISERROR (14080, 11, -1, @publisher)
		RETURN (1)
	END

	-- Clear publisher info from tracking tables
	DELETE	IHpublishercolumnconstraints
	FROM	IHpublishercolumnconstraints col2cons
	JOIN	IHpublisherconstraints ihcons on col2cons.publisherconstraint_id = ihcons.publisherconstraint_id
	WHERE	ihcons.publisher_id = @publisher_id

	DELETE	IHpublisherconstraints
	WHERE	publisher_id = @publisher_id

	DELETE	IHpublishercolumnindexes
	FROM	IHpublishercolumnindexes col2idx
	JOIN	IHpublisherindexes ihidx on col2idx.publisherindex_id = ihidx.publisherindex_id
	WHERE	ihidx.publisher_id = @publisher_id

	DELETE	IHpublisherindexes
	WHERE	publisher_id = @publisher_id

	DELETE	IHcolumns
	FROM	IHcolumns ihc
	JOIN	IHpublishercolumns ihpc ON ihc.publishercolumn_id = ihpc.publishercolumn_id
	WHERE	ihpc.publisher_id = @publisher_id

	DELETE	IHarticles
	FROM	IHarticles ih
	JOIN	MSpublications mspub ON ih.publication_id = mspub.publication_id
	WHERE	mspub.publisher_id = @publisher_id

	DELETE	IHpublishercolumns
	WHERE	publisher_id = @publisher_id

	DELETE	IHpublishertables
	WHERE	publisher_id = @publisher_id

	DELETE	IHpublications
	FROM	IHpublications ihpub
	JOIN	MSpublications mspub ON ihpub.pubid = mspub.publication_id
	WHERE	mspub.publisher_id = @publisher_id

	DELETE	IHpublishers
	WHERE	publisher_id = @publisher_id

	IF @publisher_type LIKE 'ORACLE%'
	BEGIN
		BEGIN TRY
			EXEC @retcode = sys.sp_ORAdroppublisher @publisher
		END TRY

		BEGIN CATCH
			if(@no_checks = 1)
				RETURN(0)
			ELSE
				RETURN(1)						
		END CATCH

		if(@no_checks = 1)
			RETURN(0)		

        IF (@@ERROR <> 0) OR (@retcode <> 0)
            RETURN(1)	
	END
	
	RETURN (0)
END

 
Last revision 2008RTM
See also

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