May 7, 2012

sp_MSanonymous_status (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_MSanonymous_status(int @agent_id
, int @no_init_sync
, varbinary @last_xact_seqno)

MetaData:

 CREATE PROCEDURE sys.sp_MSanonymous_status  
(
@agent_id int,
@no_init_sync int = 0,
@last_xact_seqno varbinary(16)
)
as
begin
set nocount on

declare @virtual_agent_id int -- virtual sub agent id --
declare @anonymous_agent_id int -- virtual anonymous agent id --

-- Note @agent_id will be overwritten later.
select @virtual_agent_id = virtual_agent_id,
@anonymous_agent_id = anonymous_agent_id
from MSdistribution_agents where
id = @agent_id

-- Return error if agent entry does not exists (being deleted).
if @virtual_agent_id is null
begin
raiserror(21072, 16, -1)
return(1)
end

-- If no init sync, use anonymous account to start immediately.
-- If first time, or still working on the first snapshot, or just finished
-- the first snapshot, use virtual account. This is to cover the case
-- of multiple snapshot transactions (for example, one per article) in the first
-- snapshot.
-- otherwise use virtual anonymous account
if @no_init_sync = 1
select @agent_id = @anonymous_agent_id
else if @last_xact_seqno = 0x00
select @agent_id = @virtual_agent_id
else
select @agent_id = @anonymous_agent_id

--
-- Call main procedure for to get status
-- PAL security check is done in the main proc
--
exec sys.sp_MSsubscription_status
@agent_id = @agent_id
end

No comments:

Post a Comment

Total Pageviews