May 15, 2012

sp_MSgetmetadata_changedlogicalrecordmembers (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_MSgetmetadata_changedlogicalrecordmembers(uniqueidentifier @parent_rowguid
, bigint @commongen
, int @parent_nickname)

MetaData:

 create procedure sys.sp_MSgetmetadata_changedlogicalrecordmembers   
(@parent_rowguid uniqueidentifier,
@commongen bigint,
@parent_nickname int)
as
declare @retcode int

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

select mc.tablenick, mc.rowguid, mc.generation, type=2, mc.lineage, mc.colv1
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 > @commongen

UNION

select mc.tablenick, mc.rowguid, mc.generation, mc.type, mc.lineage, NULL
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 > @commongen

return 0

No comments:

Post a Comment

Total Pageviews