May 8, 2012

sp_MScheckIsPubOfSub (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_MScheckIsPubOfSub(uniqueidentifier @pubid
, uniqueidentifier @subid)

MetaData:

   
--
* This proc will discover if the specified subid is a subscriber to the specified pubid.
* Currently, this is a one level check, it does not support n-level re-publishing.
--
create procedure sys.sp_MScheckIsPubOfSub
@pubid uniqueidentifier,
@subid uniqueidentifier,
@pubOfSub bit output
as

declare @retcode int

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

if exists(select sms_a.subid from sysmergesubscriptions as sms_a
where pubid in (select smp.pubid from sysmergesubscriptions as sms join sysmergepublications as smp on
sms.subscriber_server = smp.publisher and sms.db_name = smp.publisher_db where sms.subid = @pubid)
and sms_a.subid <> sms_a.pubid and sms_a.subid = @subid)
begin
select @pubOfSub = 1
end
else
begin
select @pubOfSub = 0
end

return 0

No comments:

Post a Comment

Total Pageviews