Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSmarksubscriptionvalidation

  No additional text.


Syntax
create procedure sys.sp_MSmarksubscriptionvalidation (
    @publication sysname,    /* publication name */
    @subscriber sysname,             /* subscriber name */
    @destination_db sysname   /* destination database name */
) AS

    DECLARE @retcode int, @pubid int

    DECLARE @artid int, @active tinyint
    DECLARE @srvid smallint
    DECLARE @non_sql_flag bit
    DECLARE @repl_freq int
    				,@OPT_ENABLED_FOR_HET_SUB tinyint
    				,@enabled_for_hsub bit


    -- Initialization
    select @active = 2
    			,@OPT_ENABLED_FOR_HET_SUB = 0x4
    			,@enabled_for_hsub = 0

    /*
    ** Security Check.
    */
    exec @retcode = sys.sp_MSreplcheck_publish
    if @@ERROR <> 0 or @retcode <> 0
        return(1)

    /* 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
    		, @enabled_for_hsub = (case options & @OPT_ENABLED_FOR_HET_SUB when @OPT_ENABLED_FOR_HET_SUB then 1 else 0 end)
    		FROM syspublications WHERE name = @publication
    if @pubid is null
    begin
        RAISERROR (20026, 16, -1, @publication)
        RETURN (1)
    END

    -- Article validation is not valid for 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)

    if (@enabled_for_hsub = 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.srvname = UPPER(@subscriber)
           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
         WHERE sub.srvname = UPPER(@subscriber)
           AND sub.artid = art.artid
           AND art.pubid = @pubid
           AND ((@destination_db = N'%') OR (sub.dest_db = @destination_db))
           AND sub.status = @active

    if @artid is null
        return 0

    declare @command nvarchar (1000)

    -- No need to quote them
    select @command = @subscriber + @destination_db
    exec @retcode = sys.sp_replpostcmd
        0,              -- partial flag
        @pubid,
        @artid,
        68,             -- subscription validation marker
        @command
    if @retcode <> 0 or @@error <> 0
        return 1

    RETURN(0)

 
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