May 15, 2012

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


sys.sp_MSgetalternaterecgens(uniqueidentifier @repid)


 --  retrieve recgen information about all alternate publications known at this replica  
create procedure sys.sp_MSgetalternaterecgens
@repid uniqueidentifier

declare @retcode int
declare @publisher sysname
declare @publisher_db sysname
declare @publication sysname

-- do permission checking
exec @retcode = sys.sp_MSrepl_PAL_rolecheck @repid = @repid
if @retcode<>0 or @@ERROR<>0
return (1)

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

select distinct p.pubid as altpubid, s.recguid as recguid, s.recgen as recgen
from dbo.sysmergesubscriptions s, dbo.sysmergepublications p, dbo.MSmerge_altsyncpartners alt
where (p.pubid = alt.subid or p.pubid = alt.alternate_subid) and
p.pubid <> @repid and
upper(s.subscriber_server collate SQL_Latin1_General_CP1_CS_AS) = upper(p.publisher collate SQL_Latin1_General_CP1_CS_AS) and
s.db_name = p.publisher_db and
s.pubid = @repid
and s.recguid is not null and s.recgen is not null
return @retcode

No comments:

Post a Comment

Total Pageviews