May 8, 2012

sp_MSCleanupForPullReinit (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_MSCleanupForPullReinit(nvarchar @publication
, nvarchar @publisher_db
, nvarchar @publisher)


create procedure sys.sp_MSCleanupForPullReinit (
@publication sysname,
@publisher_db sysname,
@publisher sysname = NULL
) AS
declare @pubid uniqueidentifier
declare @artid uniqueidentifier
declare @retcode smallint

-- Security Check
EXEC @retcode = sys.sp_MSreplcheck_publish
IF @@ERROR <> 0 or @retcode <> 0
return (1)

if @publisher is NULL
set @publisher = publishingservername()

-- This only gets called after database is enable to subscribe, so
-- sysmergepublications should exist
select @pubid = pubid from dbo.sysmergepublications
where name = @publication and
publisher_db = @publisher_db and
upper(publisher collate SQL_Latin1_General_CP1_CS_AS) = upper(@publisher collate SQL_Latin1_General_CP1_CS_AS) and
status <> 7 -- REPLICA_STATUS_BeforeRestore

-- Normal case - nothing to cleanup, just return --
if @pubid is null
return (1)

select @retcode = 0
exec @retcode = sys.sp_MSCleanupForPullReinitWithPubId @pubid = @pubid

return @retcode

No comments:

Post a Comment

Total Pageviews