Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_ORAValidateRowFilter

  No additional text.


Syntax


-- Name:
--		sp_ORAValidateRowFilter

-- Description:
--		Pre-Validate an Oracle row filter

-- Inputs:
--		@publisher		== name of Oracle publisher
--		@owner			== table owner
--		@table			== table name
--		@columnmask		== mask identifying columns in article
--		@rowfilter		== row filter
--		@publisher_type	== publisher type

-- Returns:
--		Return rowset with a single int value (0 for valid row filter, 1 for invalid row filter)

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

--		NOTE:	An invalid row filter is not a failure with respect to the return code.

-- Security:
--		internal stored procedure
-- Requires Certificate signature for catalog access

CREATE PROCEDURE sys.sp_ORAValidateRowFilter
(
	@publisher		sysname,
	@owner			sysname,
	@table			sysname,
	@columnmask		binary(128),
	@rowfilter		nvarchar(max),
	@publisher_type	sysname
)
AS
BEGIN
	DECLARE @retcode	int
	DECLARE @pubid		int
	DECLARE @mask		binary(128)

	
	-- Security Check: require sysadmin
	
	IF (ISNULL(IS_SRVROLEMEMBER('sysadmin'),0) = 0)
	BEGIN
		RAISERROR(21089,16,-1)
		RETURN (1)
	END

	-- 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 this is an ORACLE GATEWAY publisher, set mask to article column
	-- mask, indicating that only columns in the article can be referenced
	-- in the row filter
	IF @publisher_type = N'ORACLE GATEWAY'
		SELECT @mask = @columnmask
	ELSE
		SELECT @mask = NULL	

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

	-- Issue call to validate row filter
	INSERT INTO #hquery (cmd) VALUES (N'{call HREPL.ValidateRowFilter(')
	INSERT INTO #hquery (cmd) VALUES (sys.fn_replquotename(@owner, '''')+ N',')
	INSERT INTO #hquery (cmd) VALUES (sys.fn_replquotename(@table, '''')+ N',')
	IF @mask IS NULL
		INSERT INTO #hquery (cmd) VALUES (N' NULL,')
	ELSE
		INSERT INTO #hquery (cmd) VALUES (N'''' + RIGHT(sys.fn_varbintohexstr(@mask), 256) + N''',')
	INSERT INTO #hquery (cmd) VALUES (sys.fn_replquotename(@rowfilter, '''') + N')}')
	
	EXEC @retcode = sys.sp_IHquery @publisher

	IF @retcode != 0 OR @@error != 0
	BEGIN
		SELECT 1
		RETURN (0)
	END

	SELECT 0
	RETURN (0)
END

 
Last revision 2008RTM
See also

  sp_IHValidateRowFilter (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