Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHflushmetadata

  No additional text.


Syntax

CREATE PROCEDURE sys.sp_IHflushmetadata
(
    @publisher          sysname,
    @source_owner       sysname,
    @source_table       sysname
)
AS
BEGIN
    DECLARE @retcode            int
    DECLARE @publisher_type     sysname
    DECLARE @publisher_id       int
    DECLARE @table_id           int

	
    -- Get publisher info
    
    EXEC @retcode = sys.sp_MSrepl_getpublisherinfo  @publisher      = @publisher,
                                                    @publisher_type = @publisher_type OUTPUT,
                                                    @publisher_id   = @publisher_id   OUTPUT

	
    -- Reject unsupported publisher types
    
    IF @publisher_type NOT IN (N'ORACLE', N'ORACLE GATEWAY')
    BEGIN
        RAISERROR (21645, 16, -1, @publisher_type)
        RETURN (1)
    END

	
	-- Get table id
	
	SELECT	@table_id = table_id
	FROM	dbo.IHpublishertables
	WHERE	publisher_id = @publisher_id
	  AND	owner        = @source_owner
	  AND	name         = @source_table

	
	-- Delete publisher information if the table is not used by any other articles
	
	IF NOT EXISTS
	(
		SELECT	*
		FROM	IHarticles
		WHERE	publisher_id = @publisher_id
		  AND	table_id     = @table_id
	)
	BEGIN

		-- Delete the constraints
		DELETE	IHpublishercolumnconstraints
		FROM	IHpublishercolumnconstraints col2con
		JOIN	IHpublisherconstraints ihcons on col2con.publisherconstraint_id = ihcons.publisherconstraint_id
		WHERE	ihcons.publisher_id = @publisher_id
		  AND	ihcons.table_id     = @table_id
	
		IF @@ERROR <> 0
			RETURN (1)
	
		DELETE	IHpublisherconstraints
		FROM	IHpublisherconstraints ihcons
		WHERE	publisher_id = @publisher_id
		  AND	table_id     = @table_id
	
		IF @@ERROR <> 0
			RETURN (1)

		-- Delete the indexes
		DELETE	IHpublishercolumnindexes
		FROM	IHpublishercolumnindexes col2idx
		JOIN	IHpublisherindexes idx on col2idx.publisherindex_id = idx.publisherindex_id
		WHERE	idx.publisher_id = @publisher_id
		  AND	idx.table_id     = @table_id
	
		IF @@ERROR <> 0
			RETURN (1)
	
		DELETE	IHpublisherindexes
		FROM	IHpublisherindexes ihidx
		WHERE	publisher_id = @publisher_id
		  AND	table_id     = @table_id
	
		IF @@ERROR <> 0
			RETURN (1)

		-- Delete the columns
		DELETE	IHpublishercolumns
		FROM	IHpublishercolumns
		WHERE	publisher_id = @publisher_id
		  AND  	table_id     = @table_id

		IF @@ERROR <> 0
			RETURN (1)

		-- Delete the table
		DELETE	IHpublishertables
		FROM	IHpublishertables
		WHERE	publisher_id = @publisher_id
		  AND	table_id     = @table_id

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

	RETURN (0)
END

 
Last revision 2008RTM
See also

  sp_IHdroparticle (Procedure)
sp_MSdrop_repltran (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