Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSuplineageversion

  No additional text.


Syntax

create procedure sys.sp_MSuplineageversion
    (@tablenick int,
     @rowguid uniqueidentifier,
     @version int)
as
    declare @replnick binary(6)
    declare @curversion int
    declare @lineage varbinary(311)
    declare @retcode int
    declare @colv varbinary(2953)
    declare @col_tracking int
    declare @rowintombstone int

    /*
    ** Check to see if current publication has permission
    */
    exec @retcode = sys.sp_MSrepl_PAL_rolecheck @tablenick = @tablenick
    if (@retcode <> 0) or (@@error <> 0)
        return 1

    exec sys.sp_MSgetreplnick @replnick = @replnick out
    if (@@error <> 0) or @replnick IS NULL
        begin
        RAISERROR (14055, 11, -1)
        RETURN(1)
        end
    if (@rowguid is null)
        begin
        RAISERROR(14043, 16, -1, '@rowguid', 'sp_MSuplineageversion')
        return (1)
        end
    if (@tablenick is null)
        begin
        RAISERROR(14043, 16, -1, '@tablenick', 'sp_MSuplineageversion')
        return (1)
        end

    select @col_tracking = column_tracking
             from dbo.sysmergearticles where nickname = @tablenick

    begin transaction
    save tran sp_MSuplineageversion

    -- get lineage, locking row in MSmerge_contents. If not found there, also try MSmerge_tombstone
    set @rowintombstone= 0
    select @lineage = lineage, @colv = colv1 from dbo.MSmerge_contents with (UPDLOCK ROWLOCK index = 1) where tablenick = @tablenick and
            rowguid = @rowguid
    if (@lineage is null)
    begin
        select @lineage = lineage from dbo.MSmerge_tombstone with (UPDLOCK ROWLOCK index = 1) where tablenick = @tablenick and
            rowguid = @rowguid
        set @colv= NULL
        set @rowintombstone= 1
    end
    if (@lineage is null)
    begin
        RAISERROR(14043, 16, -1, '@lineage', 'sp_MSuplineageversion')
        goto Failure
    end

    set @curversion = 0
    while (@curversion < @version)
    begin
        set @lineage= { fn UPDATELINEAGE(@lineage, @replnick, 1) }
        set @curversion= { fn GETMAXVERSION(@lineage) }
    end
    if (@col_tracking = 0 or @colv is NULL)
        set @colv = NULL
    else
        set @colv = { fn UPDATECOLVBM(@colv, @replnick, 0x01, 0x00, @curversion) }

    -- update lineage in MSmerge_contents or MSmerge_tombstone
    if (@rowintombstone = 0)
    begin
        update dbo.MSmerge_contents set lineage = @lineage, colv1 = @colv where
            tablenick = @tablenick and rowguid = @rowguid
    end
    else
    begin
        update dbo.MSmerge_tombstone set lineage = @lineage where
            tablenick = @tablenick and rowguid = @rowguid
    end

    commit
    return (0)
Failure:
    rollback tran sp_MSuplineageversion
    commit tran
    return(1)

 
Last revision 2008RTM
See also

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