May 8, 2012

sp_MScheckfailedprevioussync (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_MScheckfailedprevioussync(uniqueidentifier @pubid)

MetaData:

   
--
* This proc is called on subscriber when the merge agent wants to do
* consolidation of generations. This proc checks of the last sync failed.
* If the last sync failed then the merge agent does not do consolidation.
* This procs checks for any generations with genstatus of 4 in the genshistory
* table to make this determination.
--
create procedure sys.sp_MScheckfailedprevioussync
@pubid uniqueidentifier,
@last_sync_failed bit output
as

declare @retcode int

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

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

if exists(select * from dbo.MSmerge_genhistory mgh JOIN dbo.sysmergearticles sma
ON mgh.art_nick = sma.nickname
where mgh.genstatus = 4 and
(sma.pubid = @pubid or mgh.art_nick = 0))
begin
select @last_sync_failed = 1
end
else
begin
select @last_sync_failed = 0
end

return 0

No comments:

Post a Comment

Total Pageviews