April 13, 2012

sp_addpublication (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_addpublication(nvarchar @allow_partition_switch
, nvarchar @replicate_partition_switch
, nvarchar @publication
, int @taskid
, nvarchar @restricted
, nvarchar @sync_method
, nvarchar @repl_freq
, nvarchar @description
, nvarchar @status
, nvarchar @independent_agent
, nvarchar @immediate_sync
, nvarchar @enabled_for_internet
, nvarchar @allow_push
, nvarchar @allow_pull
, nvarchar @allow_anonymous
, nvarchar @allow_sync_tran
, nvarchar @autogen_sync_procs
, int @retention
, nvarchar @allow_queued_tran
, nvarchar @snapshot_in_defaultfolder
, nvarchar @alt_snapshot_folder
, nvarchar @pre_snapshot_script
, nvarchar @post_snapshot_script
, nvarchar @compress_snapshot
, nvarchar @ftp_address
, int @ftp_port
, nvarchar @ftp_subdirectory
, nvarchar @ftp_login
, nvarchar @ftp_password
, nvarchar @allow_dts
, nvarchar @allow_subscription_copy
, nvarchar @conflict_policy
, nvarchar @centralized_conflicts
, int @conflict_retention
, nvarchar @queue_type
, nvarchar @add_to_active_directory
, nvarchar @logreader_job_name
, nvarchar @qreader_job_name
, nvarchar @publisher
, nvarchar @allow_initialize_from_backup
, int @replicate_ddl
, nvarchar @enabled_for_p2p
, nvarchar @publish_local_changes_only
, nvarchar @enabled_for_het_sub
, nvarchar @p2p_conflictdetection
, int @p2p_originator_id
, nvarchar @p2p_continue_onconflict)

MetaData:

   
--
-- Name:
-- sp_addpublication
--
-- Description:
-- Creates a snapshot or transactional publication. This stored procedure is executed at
-- the Publisher on the publication database.
--
-- Returns:
-- Return code (0 for success, 1 for failure)
--
-- Security:
-- Public
--
-- Notes:
-- Re-directs to call sp_MSrepl_addpublication in the correct db context (distributor for HREPL)
--

create procedure sys.sp_addpublication
(
@publication sysname,
@taskid int = 0, -- backward compatible
@restricted nvarchar (10) = N'false', -- publication security
@sync_method nvarchar(40) = NULL, -- (bcp) native, (bcp) character
-- NULL defaults to appropriate sync method for pub type
@repl_freq nvarchar(10) = N'continuous', -- continuous, snapshot
@description nvarchar (255) = NULL,
@status nvarchar(8) = N'inactive', -- publication status; 0=inactive, 1=active
@independent_agent nvarchar(5) = N'false',
@immediate_sync nvarchar(5) = NULL,
@enabled_for_internet nvarchar(5) = N'false',
@allow_push nvarchar(5) = N'true',
@allow_pull nvarchar(5) = N'false',
@allow_anonymous nvarchar(5) = N'false',
-- SyncTran
@allow_sync_tran nvarchar(5) = N'false',
@autogen_sync_procs nvarchar(5) = NULL, -- auto gen sync tran procs per article
@retention int = 336, -- 14 days
@allow_queued_tran nvarchar(5) = N'false',
-- Portable Snapshot
@snapshot_in_defaultfolder nvarchar(5) = N'true',
@alt_snapshot_folder nvarchar(255) = NULL,
-- Snapshot pre/post- commands
@pre_snapshot_script nvarchar(255) = NULL,
@post_snapshot_script nvarchar(255) = NULL,
-- Snapshot compression
@compress_snapshot nvarchar(5) = N'false',
-- Post 7.0 FTP
@ftp_address sysname = NULL,
@ftp_port int = 21,
@ftp_subdirectory nvarchar(255) = NULL,
@ftp_login sysname = N'anonymous',
@ftp_password sysname = NULL,
@allow_dts nvarchar(5) = N'false',
@allow_subscription_copy nvarchar(5) = N'false',
@conflict_policy nvarchar(100) = NULL, -- NULL, 'pub wins', 'sub reinit', 'sub wins'
@centralized_conflicts nvarchar(5) = NULL, -- NULL, 'true', 'false'
@conflict_retention int = 14,
@queue_type nvarchar(10) = NULL, -- NULL, 'sql'
@add_to_active_directory nvarchar(10) = N'false',
@logreader_job_name sysname = NULL,
@qreader_job_name sysname = NULL,
@publisher sysname = NULL,
-- Backup subscription support
@allow_initialize_from_backup nvarchar(5) = NULL, -- NULL, 'false', 'true'
@replicate_ddl int = NULL,
-- PeerToPeer
@enabled_for_p2p nvarchar(5) = N'false',
@publish_local_changes_only nvarchar(5) = N'false',
-- Heterogeneous subscriptions
@enabled_for_het_sub nvarchar(5) = N'false',
-- PeerToPeer conflict detection
@p2p_conflictdetection nvarchar(5) = N'false',
@p2p_originator_id int = NULL,
@p2p_continue_onconflict nvarchar(5) = N'false',
@allow_partition_switch nvarchar(5) = N'false',
@replicate_partition_switch nvarchar(5) = NULL
)
AS
BEGIN
set nocount on
DECLARE @cmd nvarchar(4000)
,@retcode int
,@publisher_type sysname

EXEC @retcode = sys.sp_MSrepl_getpublisherinfo @publisher = @publisher,
@publisher_type = @publisher_type OUTPUT,
@rpcheader = @cmd OUTPUT
IF @retcode != 0 or @@error !=0
RETURN 1

-- Add sp
select @publisher = UPPER(@publisher)
,@cmd = @cmd + N'sys.sp_MSrepl_addpublication'

EXEC @retcode = @cmd
@publication,
@taskid,
@restricted,
@sync_method,
@repl_freq,
@description,
@status,
@independent_agent,
@immediate_sync,
@enabled_for_internet,
@allow_push,
@allow_pull,
@allow_anonymous,
@allow_sync_tran,
@autogen_sync_procs,
@retention,
@allow_queued_tran,
@snapshot_in_defaultfolder,
@alt_snapshot_folder,
@pre_snapshot_script,
@post_snapshot_script,
@compress_snapshot,
@ftp_address,
@ftp_port,
@ftp_subdirectory,
@ftp_login,
@ftp_password,
@allow_dts,
@allow_subscription_copy,
@conflict_policy,
@centralized_conflicts,
@conflict_retention,
@queue_type,
@add_to_active_directory,
@logreader_job_name,
@qreader_job_name,
@publisher,
@allow_initialize_from_backup,
@replicate_ddl,
@publisher_type,
@enabled_for_p2p,
@publish_local_changes_only,
@enabled_for_het_sub,
@p2p_conflictdetection,
@p2p_originator_id,
@p2p_continue_onconflict,
@allow_partition_switch,
@replicate_partition_switch

RETURN (@retcode)
END

No comments:

Post a Comment

Total Pageviews