Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_ORAdroparticle

  No additional text.


Syntax


-- Name:
--          sp_ORAdroparticle

-- Description:
--          Drop oracle article info

-- Security:
--          Internal

-- Returns:
--          Success/failure

-- Notes:
--			This stored procedure calls the HREPL.UnpublishTable on the Oracle publisher to
--			remove the replication trigger and delete the tracking table, if the article being dropped
--			is the last published article associated with the specific Oracle table.

-- Owner:
--          

CREATE PROCEDURE sys.sp_ORAdroparticle
(
	@publisher		sysname,
	@articleID		int,
	@publisherID	int,
	@tableID		int,
	@owner			sysname,
	@tablename		sysname,
	@viewname		nvarchar(256),
	@distributortimestamp	datetime
)
AS
BEGIN
	DECLARE @retcode int,
			@droptriggers int

	SET NOCOUNT ON

	-- Define sp_IHquery support table
	create table #hquery
	(
		seq	int identity(2,1),
		cmd	nvarchar(4000)
	)

	-- If the publisher table is associated with other articles from transactional publications,
	-- don't drop the triggers and log table.
	IF EXISTS
	(
		SELECT	*
		FROM	IHarticles a,
				IHpublications p
		WHERE	a.publisher_id = @publisherID
		  AND	a.table_id = @tableID
		  AND	a.publication_id = p.pubid
		  AND	p.repl_freq = 0
	)
	BEGIN
		SET @droptriggers = 0
	END
	ELSE
	BEGIN
		SET @droptriggers = 1
	END
	
	IF @@ERROR <> 0
	BEGIN
		RAISERROR (21630, 16, -1, @tablename)
		RETURN (1)
	END

	--  Call the remote routine to unpublish the table
	INSERT INTO #hquery (cmd) VALUES (N'{call HREPL.UnPublishTable(')
	INSERT INTO #hquery (cmd) VALUES (QUOTENAME(@owner, '''') + N',')
	INSERT INTO #hquery (cmd) VALUES (QUOTENAME(@tablename, '''') + N',')
	INSERT INTO #hquery (cmd) VALUES (CONVERT(NVARCHAR(255), @tableID) + N',')
	INSERT INTO #hquery (cmd) VALUES (QUOTENAME(@viewname, '''') + N',')
	INSERT INTO #hquery (cmd) VALUES (CONVERT(NVARCHAR(255), @droptriggers) + N', ')
	INSERT INTO #hquery (cmd) VALUES (QUOTENAME(CONVERT(NVARCHAR(255), @distributortimestamp, 121), '''') + N' )}')

	EXEC @retcode = sys.sp_IHquery @publisher

	IF  (@@error <> 0 OR @retcode <> 0)
	BEGIN
		RAISERROR (21631, 16, -1, @tablename)
       	RETURN (1)
	END

	RETURN(0)
END	

 
Last revision 2008RTM
See also

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