Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_ORASchemaFilter

  No additional text.


Syntax


-- Name:
--		sp_ORASchemaFilter

-- Description:
--		Update the schema filter set used to control those schema
--		whose tables are examined by sp_ORAenumpublishertables (Oracle specific)

-- Inputs:
--		@publisher		== name of Oracle publisher
--		@operation		== operation ('add', 'drop', 'help')
--		@schema			== schema name

-- Returns:
--		Return code (0 for success, 1 for failure)

-- Security:
--		internal stored procedure



CREATE PROCEDURE sys.sp_ORASchemaFilter
(
	@publisher		sysname,
	@schema			sysname = NULL,
	@operation		nvarchar(4) = N'help'
)
AS
BEGIN
	DECLARE @retcode	int
	DECLARE @pubid		int
	DECLARE @cmd			nvarchar(400)
	DECLARE	@InsColumnList		nvarchar(200)
	DECLARE	@SelectColumnList	nvarchar(200)

	-- Get publisher ID
	SELECT @pubid = srvid
	FROM	master.dbo.sysservers
	WHERE	UPPER(srvname collate database_default) = UPPER(@publisher)
	
	IF @pubid IS NULL
	BEGIN
		RAISERROR(21600, 16, -1, @publisher)
		RETURN (1)
	END

    IF LOWER(@operation collate SQL_Latin1_General_CP1_CS_AS) NOT IN (N'add', N'drop', N'help')
    BEGIN
		RAISERROR (21686, 16, -1, @operation)
       	RETURN (1)
    END

	IF LOWER(@operation collate SQL_Latin1_General_CP1_CS_AS) IN (N'add', N'drop') AND
	   @schema IS NULL
    	BEGIN
		RAISERROR (21689, 16, -1)
        	RETURN (1)
    	END

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

	-- Process add
	IF LOWER(@operation collate SQL_Latin1_General_CP1_CS_AS) = 'add'
        BEGIN
		-- Insert the schema into the HREPL_SchemaFilter table
		INSERT INTO #hquery(cmd) VALUES (N'INSERT INTO HREPL_SchemaFilter VALUES(')
		INSERT INTO #hquery (cmd) VALUES (sys.fn_replquotename(@schema, '''') + N')')

		EXEC @retcode = sys.sp_IHquery @publisher
		IF  (@@error <> 0 OR @retcode <> 0 )
		BEGIN
			RAISERROR (21685, 16, -1, 'add', @publisher)
    			RETURN (1)
		END

		RETURN(0)
	END
		

	-- Process drop
	IF LOWER(@operation collate SQL_Latin1_General_CP1_CS_AS) = 'drop'
        BEGIN
		-- Delete the schema from the HREPL_SchemaFilter table
		INSERT INTO #hquery(cmd) VALUES (N'DELETE FROM HREPL_SchemaFilter ')
		INSERT INTO #hquery(cmd) VALUES (N'WHERE SchemaFilter_Name = ')
		INSERT INTO #hquery (cmd) VALUES (sys.fn_replquotename(@schema, ''''))

		EXEC @retcode = sys.sp_IHquery @publisher
		IF  (@@error <> 0 OR @retcode <> 0 )
		BEGIN
			RAISERROR (21685, 16, -1, 'drop', @publisher)
    			RETURN (1)
		END

		RETURN(0)
	END

	-- Process help
	CREATE TABLE #schemafilter
	(
		schemaname		sysname
	)

	
	-- populate a temp table with the result of a query of HREPL_SchemaFilter
	
	SELECT @InsColumnList    = 'schemaname'
	SELECT @SelectColumnList = 'SCHEMAFILTER_NAME'

	INSERT INTO #hquery(cmd) VALUES (N'SELECT SCHEMAFILTER_NAME FROM HREPL_SCHEMAFILTER')
	
	EXEC @retcode = sp_ORAremotequery
					@Server			= @publisher,
					@SelectColumnList	= @SelectColumnList,
					@InsTable		= '#schemafilter',
					@InsColumnList		= @InsColumnList

	IF  (@@error <> 0 OR @retcode <> 0)
	BEGIN
		RAISERROR (21685, 16, -1, 'help', @publisher)
		RETURN (1)
	END

	if @schema IS NOT NULL
		SELECT schemaname FROM #schemafilter WHERE schemaname = @schema
	ELSE
		SELECT schemaname FROM #schemafilter

	RETURN (0)
END

 
Last revision 2008RTM
See also

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