April 18, 2012

sp_dbmmonitorchangemonitoring (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_dbmmonitorchangemonitoring(int @parameter_id
, int @value)

MetaData:

 create procedure sys.sp_dbmmonitorchangemonitoring   
(
@parameter_id int, -- There is only one parameter_id now. 1 = update period in minutes.
@value int
)
as
begin
set nocount on
if (is_srvrolemember( N'sysadmin') <> 1 )
begin
raiserror(21089, 16, 1)
return 1
end

declare @retcode int,
@schedname nvarchar( 256 )

select @schedname = isnull( formatmessage( 32048 ), N'Database Mirroring Schedule' )

if (@parameter_id < 1 OR @parameter_id > 1)
begin
raiserror( 32036, 16, 1 )
return 1
end

if (@parameter_id = 1) -- kind of a redundant check
begin
-- validate update_period to make sure that it is a reasonable number. 1-120 minutes for now.
-- do not forget to keep this in synch with the add sp.
if (@value < 1 or @value > 120)
begin
raiserror ( 32032, 16, 1, @value) -- specific message for the update period.
return( 1 )
end
exec @retcode = msdb.dbo.sp_update_schedule
@name = @schedname,
@freq_type = 4, -- Daily
@freq_interval = 1, -- Every 1 days
@freq_subday_type = 4, -- Based on Minutes
@freq_subday_interval = @value -- interval
end

if ( @@error != 0 OR @retcode != 0 )
begin
raiserror( 32035, 16, 1 )
return 1
end

return 0
end

No comments:

Post a Comment

Total Pageviews