May 16, 2012

sp_MShelp_snapshot_agent (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_MShelp_snapshot_agent(int @agent_id)

MetaData:

   

--
-- Name:
-- sp_MShelp_snapshot_agent
--
-- Description:
-- Retrieves snapshot agent information.
--
-- Parameters:
-- See the procedure definition.
--
-- Returns:
-- 0 - succeeded
-- 1 - failed
--
-- Result:
-- None
--
-- Security:
--
-- This procedure can only be called by replication_agent. It must
-- be executed in the distribution db and the caller must have the
-- following:
--
-- Min Requirement
-- -- -- -- -- -- -- -- -- -- -- -
-- DBO Distribution DBO
-- Requires Certificate signature for catalog access
--
create procedure sys.sp_MShelp_snapshot_agent
(
@agent_id int
)
as
begin
declare @retcode int,
@publisher sysname,
@publisher_security_mode int,
@publisher_login sysname,
@publisher_password nvarchar(524)

--
-- make sure this is a replication agent.
-- if sessionproperty('replication_agent') != 1
-- begin
-- -- "You do not have sufficient permission to run this command."
-- raiserror(14260, 16, -1)
-- return 1
-- end
--

-- sysadmin or db_owner have access
if is_srvrolemember('sysadmin') != 1
and is_member('db_owner') != 1
begin
-- "You do not have sufficient permission to run this command."
raiserror(14260, 16, -1)
return 1
end

-- retrieve the publisher server and database name
select mssa.publisher_security_mode,
mssa.publisher_login,
sys.fn_repldecryptver4(mssa.publisher_password)
from MSsnapshot_agents mssa
where mssa.id = @agent_id
if @@error <> 0 return 1

return 0
end

No comments:

Post a Comment

Total Pageviews