Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSget_logicalrecord_lineage

  No additional text.


Syntax
create procedure sys.sp_MSget_logicalrecord_lineage(@pubid uniqueidentifier, @parent_nickname int, @parent_rowguid uniqueidentifier, @dest_common_gen bigint)
AS
begin

    declare @metadata_type  tinyint,
                    @logical_record_lineage varbinary(311),
                    @retcode smallint,
                    @procname nvarchar(270),
                    @num_dest_changed_rows int

    exec @retcode = sys.sp_MSrepl_PAL_rolecheck @pubid = @pubid
    if (@retcode <> 0) or (@@error <> 0)
        return 1

    select @procname= 'dbo.' + select_proc from dbo.sysmergearticles
            where nickname = @parent_nickname and pubid=@pubid

    set @metadata_type = 4
    set @logical_record_lineage = NULL
    set @num_dest_changed_rows = 0

    -- check for row in base table
    exec @retcode= @procname @maxschemaguidforarticle = NULL, @type=@metadata_type output, @rowguid=@parent_rowguid
    if @@error <>0 or @retcode <> 0
        return (1)

    begin tran
    if (@metadata_type = 3)
    begin
                select @metadata_type = 2, @logical_record_lineage = logical_record_lineage
               from dbo.MSmerge_contents
               with (serializable)
               where tablenick = @parent_nickname and rowguid = @parent_rowguid
    end
    else
    begin
                -- row is not in base table; either it is in tombstone, or it is missing
        set @metadata_type= 0

        select  @metadata_type = type, @logical_record_lineage = logical_record_lineage
                                from dbo.MSmerge_tombstone where
                                tablenick = @parent_nickname and rowguid = @parent_rowguid
     end

    select @num_dest_changed_rows = count(*) from dbo.MSmerge_contents mc join
					(select distinct nickname from dbo.sysmergepartitioninfoview where logical_record_parent_nickname = @parent_nickname)
					as smpi
                on mc.tablenick = smpi.nickname
                and mc.logical_record_parent_rowguid = @parent_rowguid
                and (mc.generation > @dest_common_gen or mc.generation = 0)

        select @num_dest_changed_rows = @num_dest_changed_rows + count(*) from dbo.MSmerge_tombstone mc
			join (select distinct nickname from dbo.sysmergepartitioninfoview where logical_record_parent_nickname = @parent_nickname)
					as smpi
                on mc.tablenick = smpi.nickname
                and mc.logical_record_parent_rowguid = @parent_rowguid
                and (mc.generation > @dest_common_gen or mc.generation = 0)

        commit tran

        -- select out our result set
    select @logical_record_lineage, @metadata_type, @num_dest_changed_rows

    return (0)
end

 
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