Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHmarksubscriptionvalidation

  No additional text.


Syntax


-- Name:
--          sp_IHmarksubscriptionvalidation

-- Description:
--          HREPL - marks subscription for validation

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

-- Returns:
--          Success/failure

-- Owner:
--          

create procedure sys.sp_IHmarksubscriptionvalidation
(
	@publication	sysname,
	@subscriber		sysname,
	@destination_db	sysname,
	@publisher		sysname,
	@publisher_type	sysname
)
AS
BEGIN
    DECLARE @retcode int
    DECLARE @pubid int
    DECLARE @artid int
    DECLARE @active tinyint
    DECLARE @srvid smallint
    DECLARE @non_sql_flag bit
	DECLARE @repl_freq int
	DECLARE @publisher_id int

    -- Initialization
    select @active = 2

    /* Validate names */

    EXECUTE @retcode = sys.sp_validname @publication
    IF @@ERROR <> 0 OR @retcode <> 0
        RETURN (1)

    EXECUTE @retcode = sys.sp_validname @subscriber
    IF @@ERROR <> 0 OR @retcode <> 0
        RETURN (1)

    EXECUTE @retcode = sys.sp_validname @destination_db
    IF @@ERROR <> 0 OR @retcode <> 0
        RETURN (1)

    /*
    ** Parameter Check:  @publication
    ** Check to make sure that the publication exists, that it's not NULL,
    ** and that it conforms to the rules for identifiers.
    */
    select	@pubid				= pubid,
			@repl_freq			= repl_freq,
			@publisher_id		= s.srvid
	from	syspublications p,
			master.dbo.sysservers s,
			MSpublications m
	where	p.name				= @publication
	  and	@publisher			= s.srvname
	  and	m.publisher_id		= s.srvid
	  and	m.publication_id	= p.pubid

	if @pubid is null
	begin
		RAISERROR (20026, 16, -1, @publication)
		RETURN (1)
	END
			
    -- Article validation cannot be applied to snapshot publications
    if @repl_freq <> 0
    begin
		RAISERROR (21484, 16, -1, @publication)
		RETURN (1)
    END

    /*
    ** Parameter Check:  @subscriber
    ** Check to make sure that the subscriber exists
    */
    select @subscriber = UPPER(@subscriber)

--initialize this to 0, for non-hetero ones if there isn't
--server entry in master..sysservers, this flag should stay 0 as well,
  select @non_sql_flag = 0
    SELECT	@srvid			= srvid,
			@non_sql_flag	= nonsqlsub
	FROM	master.dbo.sysservers
	WHERE	UPPER(srvname collate database_default)	= UPPER(@subscriber) collate database_default

    if @srvid is null
    BEGIN
        RAISERROR (14063, 16, -1)
        RETURN (1)
    END

    if @non_sql_flag = 1
    begin
        RAISERROR (20614, 16, -1)
        RETURN (1)
    end

    -- Wrong dest_db will be caught by the following query

    -- Check to make sure the subscription exists
    IF NOT EXISTS
	(
		SELECT	*
		FROM	syssubscriptions sub,
				sysextendedarticlesview art,
				syspublications pub
		WHERE	pub.pubid = @pubid
          AND	sub.srvid = @srvid
          AND	sub.artid = art.artid
          AND	art.pubid = pub.pubid
          AND	((@destination_db = N'%') OR (sub.dest_db = @destination_db))
	)
    BEGIN
        RAISERROR (14055, 16, -1)
        RETURN (1)
    END

    -- Select an article for that is actively subscribed.
    -- If none is found, do nothing
    select	top 1 @artid		= art.artid
    FROM	syssubscriptions sub,
			sysextendedarticlesview art,
			MSsubscriptions m
    WHERE	sub.srvid			= @srvid
      AND	sub.artid			= art.artid
      AND	art.pubid			= @pubid
      AND	sub.dest_db			= @destination_db
      AND	m.article_id		= sub.artid
      AND	m.subscriber_id		= sub.srvid
      AND	m.publication_id	= art.pubid
      AND	m.publisher_id		= @publisher_id
      AND	m.status			= @active

    if @artid is null
        return 0

    declare @command nvarchar (1000)

    -- No need to quote them
    select @command = @subscriber + @destination_db

	-- Call sp_ORAmarksubscriptionvalidationto to process the request
	exec @retcode = sys.sp_ORAmarksubscriptionvalidation	@pubid,
															@artid,
															68,
															@command,
															@publisher

	if @retcode <> 0 or @@error <> 0
	    return 1

	return 0
END

 
Last revision 2008RTM
See also

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