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_replmonitorchangepublicationthreshold(nvarchar @publisher, nvarchar @publisher_db
, nvarchar @publication
, int @publication_type
, int @metric_id
, nvarchar @thresholdmetricname
, int @value
, bit @shouldalert
, tinyint @mode)
MetaData:
create procedure sys.sp_replmonitorchangepublicationthreshold ( @publisher sysname -- cannot be null ,@publisher_db sysname -- cannot be null ,@publication sysname -- cannot be null ,@publication_type int = NULL -- NULL for wildcard, 0 transactional 1 snapshot 2 merge ,@metric_id int = NULL -- NULL if name is specified ,@thresholdmetricname sysname = NULL -- NULL if id is specified ,@value int = NULL -- NULL - skip updating value ,@shouldalert bit = NULL -- NULL - skip updating value ,@mode tinyint = 1 -- mode of operation 1 = enable, 2 = disable ) as begin set nocount on declare @retcode int ,@publication_id int -- -- constants -- declare @modeenable tinyint ,@modedisable tinyint -- -- initialize -- select @modeenable = 1 ,@modedisable = 2 -- -- security check : replmonitor -- if not (is_member(N'db_owner') = 1 or isnull(is_member(N'replmonitor'),0) = 1) begin raiserror(14260, 16, -1) return (1) end -- -- security: Has to be executed from distribution database -- if sys.fn_MSrepl_isdistdb (db_name()) != 1 begin raiserror (21482, 16, -1, 'sp_replmonitorchangepublicationthreshold', 'distribution') return 1 end -- -- check @mode -- if (@mode not in (@modeenable, @modedisable)) begin raiserror(21402, 16, -1, '@mode') return 1 end -- -- validate publication -- select @publication_id = p.publication_id from dbo.MSpublications as p join sys.servers as s on p.publisher_id = s.server_id and upper(s.name) = upper(@publisher) and p.publisher_db = @publisher_db and p.publication = @publication and p.publication_type= case when (@publication_type is null) then p.publication_type else @publication_type end if (@publication_id is null) begin raiserror(20026, 16, 1, @publication) return 1 end -- -- validate metric -- if (@metric_id is null and @thresholdmetricname is null) begin raiserror(21821, 16, -1, '@metric_id', '@thresholdmetricname') return 1 end else if (@metric_id is not null and @thresholdmetricname is null) begin select @thresholdmetricname = title from msdb.dbo.MSreplmonthresholdmetrics where metric_id = @metric_id if (@thresholdmetricname is null) begin raiserror(14200, 16, 1, '@metric_id') return 1 end end else if (@metric_id is null and @thresholdmetricname is not null) begin select @metric_id = metric_id from msdb.dbo.MSreplmonthresholdmetrics where title = lower(@thresholdmetricname) if (@metric_id is null) begin raiserror(14200, 16, 2, '@thresholdmetricname') return 1 end end else begin raiserror(21821, 16, -1, '@metric_id', '@thresholdmetricname') return 1 end -- -- proceed only if row exists -- if exists (select * from dbo.MSpublicationthresholds where publication_id = @publication_id and metric_id = @metric_id) begin -- -- Process according to the mode and update -- if (@mode = @modeenable) begin -- enable state update dbo.MSpublicationthresholds set value = case when (@value is null) then value else @value end ,shouldalert = case when (@shouldalert is null) then shouldalert else @shouldalert end ,isenabled=1 where publication_id = @publication_id and metric_id = @metric_id end else begin -- disable state update dbo.MSpublicationthresholds set isenabled=0 where publication_id = @publication_id and metric_id = @metric_id end -- -- Check if enable/disable update failed -- if (@@error != 0) return 1 end else begin raiserror(21823, 16, -1, 'enable/disable', 'MSpublicationthresholds') return 1 end -- -- return -- return 0 end
No comments:
Post a Comment