Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSresetwatermarksforalternatepublishers

  No additional text.


Syntax

create procedure sys.sp_MSresetwatermarksforalternatepublishers (
    @pubid    uniqueidentifier )
    AS
    declare @retcode         int
    declare @publisher        sysname
    declare @publisher_db    sysname
    declare @publication    sysname


    set @retcode= 0

    declare @altpub table
    (
        altpubid                uniqueidentifier not null,
        alternate_publisher        sysname collate database_default not null,
        alternate_publisher_db    sysname collate database_default not null,
        alternate_publication    sysname collate database_default not null,
        recgen                    bigint null,
        recguid                    uniqueidentifier null
    )

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

    -- Get alternate pubid, alternate publisher, alternate publisher db,
    -- alternate publication for the current publication.
    insert into @altpub
        (
            altpubid,
            alternate_publisher,
            alternate_publisher_db,
            alternate_publication
        )
    select distinct pub.pubid, pub.publisher, pub.publisher_db, pub.name
        from dbo.sysmergepublications pub, dbo.MSmerge_altsyncpartners alt
        where pub.pubid = alt.subid or pub.pubid = alt.alternate_subid

    if @@error<>0 or @retcode<>0
        goto Done

    /* For all alternate publishers for whom my current db is a subscriber, update the watermarks */
    -- make sure we don't falsely use transitive recgen optimization
    update dbo.sysmergesubscriptions
    set recgen = NULL, recguid = NULL, sentgen = NULL, sentguid = NULL, replicastate = newid()
    where subid in
        (select subid from dbo.sysmergesubscriptions s, @altpub as a
        where s.pubid = a.altpubid and s.db_name = db_name() and s.pubid <> @pubid)

    /* For all alternate publishers subscription entries, update the watermarks */
    -- make sure we don't falsely use transitive recgen optimization
    update dbo.sysmergesubscriptions
    set recgen = NULL, recguid = NULL, sentgen = NULL, sentguid = NULL, replicastate= newid()
    where subid in
        (select subid from dbo.sysmergesubscriptions s, @altpub as a
        where s.subid = a.altpubid and s.pubid <> @pubid)

Done:
    return @retcode


 
Last revision 2008RTM
See also

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