April 25, 2012

sp_getagentparameterlist (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_getagentparameterlist(int @agent_type)

MetaData:

 create procedure sys.sp_getagentparameterlist  
(
@agent_type int
)
as
begin
declare @snapshot_type int
,@logreader_type int
,@distribution_type int
,@merge_type int
,@qreader_type int

-- security check - must be sysadmin/dbo
if (IS_SRVROLEMEMBER('sysadmin') <> 1 AND is_member ('db_owner') <> 1)
begin
RAISERROR(21089,16,-1)
return 1
end

-- initialize the constants
select @snapshot_type = 1
,@logreader_type = 2
,@distribution_type = 3
,@merge_type = 4
,@qreader_type = 9

-- validate the agent_type
if (@agent_type not in
(@snapshot_type
,@logreader_type
,@distribution_type
,@merge_type
,@qreader_type))
begin
-- The agent type is NULL or is invalid
RAISERROR (21804, 16, -1, @agent_type)
return 1
end

-- return all the parameters for this agent type
SELECT
agent_type
,N'-' + parameter_name
,default_value
,min_value
,max_value
FROM msdb.dbo.MSagentparameterlist
WHERE agent_type=@agent_type
if @@error <> 0
begin
-- could not select from MSagentparameterlist
RAISERROR (21499, 16, -1, 'sys.sp_getagentparameterlist', 'SELECT from', 'msdb.dbo.MSagentparameterlist', @@error)
return 1
end

return 0
end

No comments:

Post a Comment

Total Pageviews