May 8, 2012

sp_MSchecksharedagentforpublication (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_MSchecksharedagentforpublication(int @publisher_id
, nvarchar @publisher_db
, nvarchar @publication)

MetaData:

 create procedure sys.sp_MSchecksharedagentforpublication   
(
@publisher_id int
,@publisher_db sysname
,@publication sysname
)
as
begin
set nocount on
declare @retcode int
,@publication_id int
,@independent_agent int

-- Get the publication information
select @publication_id = publication_id
,@independent_agent = independent_agent
from dbo.MSpublications
where publisher_id = @publisher_id and
publisher_db = @publisher_db and
publication = @publication
if @publication_id is NULL
begin
raiserror (20026, 16, -1, @publication)
return (1)
end
--
-- Perform PAL check with retrieved @publication_id
--
exec @retcode = sys.sp_MScheck_pull_access
@agent_type = 0, -- distrib agent
@publication_id = @publication_id
if @@error <> 0 or @retcode <> 0
begin
raiserror (15247, 16, -1)
return (1)
end
--
-- return the resultset
--
select 'runassharedagent' = case when (@independent_agent = 0) then 1 else 0 end
--
-- all done
--
return 0
end

No comments:

Post a Comment

Total Pageviews