May 21, 2012

sp_MSisreplmergeagent (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_MSisreplmergeagent()

MetaData:

   

create procedure sys.sp_MSisreplmergeagent @is_merge bit output, @at_publisher bit=0 output
as
begin
declare @cur_context varbinary(128)
declare @cur_context_first_byte binary(1)
declare @mergeagent_bitmask tinyint
declare @atpublisher_bitmask tinyint

select @mergeagent_bitmask = 8 -- snapshot=1, logreader=2, distrib=4, merge=8
select @atpublisher_bitmask = 16

select @cur_context = isnull(context_info(),0x00)

-- get the first byte out of the 128 byte array.
select @cur_context_first_byte = substring(@cur_context, 1, 1)

-- check whether it has the merge agent bit set.
select @mergeagent_bitmask = (convert(tinyint,@cur_context_first_byte) & @mergeagent_bitmask)
-- set the output param value appropriately.
select @is_merge = case when @mergeagent_bitmask = 0 then 0 else 1 end

-- check whether it has the "at publisher" bit set.
select @atpublisher_bitmask = (convert(tinyint,@cur_context_first_byte) & @atpublisher_bitmask)
-- set the output param value appropriately.
select @at_publisher = case when @atpublisher_bitmask = 0 then 0 else 1 end

return 0
end

No comments:

Post a Comment

Total Pageviews