April 13, 2012

sp_addsubscriber (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_addsubscriber(nvarchar @subscriber
, tinyint @type
, nvarchar @login
, nvarchar @password
, int @commit_batch_size
, int @status_batch_size
, int @flush_frequency
, int @frequency_type
, int @frequency_interval
, int @frequency_relative_interval
, int @frequency_recurrence_factor
, int @frequency_subday
, int @frequency_subday_interval
, int @active_start_time_of_day
, int @active_end_time_of_day
, int @active_start_date
, int @active_end_date
, nvarchar @description
, int @security_mode
, bit @encrypted_password
, nvarchar @publisher)

MetaData:

   
create procedure sys.sp_addsubscriber
(
@subscriber sysname,
@type tinyint = 0,
@login sysname = NULL,
@password nvarchar(524) = NULL,
@commit_batch_size int = NULL,
@status_batch_size int = NULL,
@flush_frequency int = NULL,
@frequency_type int = NULL,
@frequency_interval int = NULL,
@frequency_relative_interval int = NULL,
@frequency_recurrence_factor int = NULL,
@frequency_subday int = NULL,
@frequency_subday_interval int = NULL,
@active_start_time_of_day int = NULL,
@active_end_time_of_day int = NULL,
@active_start_date int = NULL,
@active_end_date int = NULL,
@description nvarchar (255) = NULL,
@security_mode int = NULL, -- backward compatible -- -- 0 standard; 1 integrated --
@encrypted_password bit = NULL,
@publisher sysname = NULL
)
AS
BEGIN
DECLARE @cmd nvarchar(4000)
DECLARE @retcode int
DECLARE @publisher_type sysname

--
-- Security Check: require sysadmin
--
IF (ISNULL(IS_SRVROLEMEMBER('sysadmin'),0) = 0)
BEGIN
RAISERROR(21089,16,-1)
RETURN (1)
END

SET @retcode = 0

EXEC @retcode = sys.sp_MSrepl_getpublisherinfo @publisher = @publisher,
@rpcheader = @cmd OUTPUT,
@publisher_type = @publisher_type OUTPUT


IF @retcode <> 0
RETURN (@retcode)

-- when called on mirror server, this adds original publiser name
-- in distribution. (MSsubscriber_info and MSsubscriber_schedule)
IF @publisher IS NULL
SET @publisher = publishingservername()

-- Add sp
SET @publisher = UPPER(@publisher) COLLATE DATABASE_DEFAULT
set @cmd = @cmd + N'sys.sp_MSrepl_addsubscriber'

EXEC @retcode = @cmd
@subscriber,
@type,
@login,
@password,
@commit_batch_size,
@status_batch_size,
@flush_frequency,
@frequency_type,
@frequency_interval,
@frequency_relative_interval,
@frequency_recurrence_factor,
@frequency_subday,
@frequency_subday_interval,
@active_start_time_of_day,
@active_end_time_of_day,
@active_start_date,
@active_end_date,
@description,
@security_mode,
@encrypted_password,
@publisher,
@publisher_type,
N'PRE-YUKON'

RETURN (@retcode)
END

No comments:

Post a Comment

Total Pageviews