Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSregenerate_mergetriggersprocs

  No additional text.


Syntax
create procedure sys.sp_MSregenerate_mergetriggersprocs(
    @pubid uniqueidentifier)
as
begin
    declare @publication sysname
    , @publisher sysname
    , @publisher_db sysname
    , @retcode int
    , @artid uniqueidentifier
    , @prev_artid uniqueidentifier
    , @article sysname
    , @snapshot_ready tinyint
    , @local_pub bit

    -- security check
    exec @retcode = sys.sp_MSreplcheck_subscribe
    if @retcode<>0 or @@ERROR<>0
        return 1

    select @publication = name, @publisher = publisher, @publisher_db = publisher_db, @snapshot_ready = snapshot_ready
    from dbo.sysmergepublications
    where pubid = @pubid

    if @publication is null
    begin
        return 1
    end

    select @local_pub = sys.fn_MSmerge_islocalpubid(@pubid)

    -- for a local publication if the snapshot is not ready there is not need to regenerate this since the snapshot will
    -- be made ready when the snaphsot is run and the snapshot will regenerate the procs and triggers.
    if @local_pub = 1 and @snapshot_ready <> 1
        return 0

    exec @retcode = sys.sp_MSregenerate_mergetriggers @publication, @publisher, @publisher_db
    if @@error<>0 OR @retcode<>0
    begin
        return 1
    end

    -- Call sp_MSsetartprocs if running on publisher. Else, call sp_MSmakearticleprocs.
    if @local_pub = 1
    begin
        -- at publisher
        select top 1 @artid = artid, @article = name from sysmergearticles where pubid = @pubid order by artid
        while @artid is not null
        begin
            exec @retcode = sys.sp_MSsetartprocs @publication=@publication, @article=@article,
                                                 @force_flag=0, @pubid=@pubid
            if @@error<>0 OR @retcode<>0
            begin
                return 1
            end

            select @prev_artid = @artid
            select @artid = NULL

            select top 1 @artid = artid, @article = name from sysmergearticles where pubid = @pubid and artid > @prev_artid order by artid
        end
    end
    else
    begin
        -- at subscriber
        select top 1 @artid = artid, @article = name from sysmergearticles where pubid = @pubid order by artid
        while @artid is not null
        begin
            exec @retcode = sys.sp_MSmakearticleprocs @pubid, @artid, 1
            if @@error<>0 OR @retcode<>0
            begin
                return 1
            end

            select @prev_artid = @artid
            select @artid = NULL

            select top 1 @artid = artid, @article = name from sysmergearticles where pubid = @pubid and artid > @prev_artid order by artid
        end
    end
end

 
Last revision 2008RTM
See also

  sp_MSdrop_rladmin (Procedure)
sp_MSrestoredbreplication (Procedure)
sp_MSrestore_sub_merge (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