SQL Flow Field Guide

sys.sp_addmergepublication

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

Creates a new merge publication.

What changes

Input
Not stated in the Microsoft summary.
Output or change
Creates a new merge publication.

Syntax at a glance

sys.sp_addmergepublication
    [ @publication = ] N'publication'
    [ , [ @description = ] N'description' ]
    [ , [ @retention = ] retention ]
    [ , [ @sync_mode = ] N'sync_mode' ]
    [ , [ @allow_push = ] N'allow_push' ]
    [ , [ @allow_pull = ] N'allow_pull' ]
    [ , [ @allow_anonymous = ] N'allow_anonymous' ]
    [ , [ @enabled_for_internet = ] N'enabled_for_internet' ]
    [ , [ @centralized_conflicts = ] N'centralized_conflicts' ]
    [ , [ @dynamic_filters = ] N'dynamic_filters' ]
    [ , [ @snapshot_in_defaultfolder = ] N'snapshot_in_defaultfolder' ]
    [ , [ @alt_snapshot_folder = ] N'alt_snapshot_folder' ]
    [ , [ @pre_snapshot_script = ] N'pre_snapshot_script' ]
    [ , [ @post_snapshot_script = ] N'post_snapshot_script' ]
    [ , [ @compress_snapshot = ] N'compress_snapshot' ]
    [ , [ @ftp_address = ] N'ftp_address' ]
    [ , [ @ftp_port = ] ftp_port ]
    [ , [ @ftp_subdirectory = ] N'ftp_subdirectory' ]
    [ , [ @ftp_login = ] N'ftp_login' ]
    [ , [ @ftp_password = ] N'ftp_password' ]
    [ , [ @conflict_retention = ] conflict_retention ]
    [ , [ @keep_partition_changes = ] N'keep_partition_changes' ]
    [ , [ @allow_subscription_copy = ] N'allow_subscription_copy' ]
    [ , [ @allow_synctoalternate = ] N'allow_synctoalternate' ]
    [ , [ @validate_subscriber_info = ] N'validate_subscriber_info' ]
    [ , [ @add_to_active_directory = ] N'add_to_active_directory' ]
    [ , [ @max_concurrent_merge = ] max_concurrent_merge ]
    [ , [ @max_concurrent_dynamic_snapshots = ] max_concurrent_dynamic_snapshots ]
    [ , [ @use_partition_groups = ] N'use_partition_groups' ]
    [ , [ @publication_compatibility_level = ] N'publication_compatibility_level' ]
    [ , [ @replicate_ddl = ] replicate_ddl ]
    [ , [ @allow_subscriber_initiated_snapshot = ] N'allow_subscriber_initiated_snapshot' ]
    [ , [ @allow_web_synchronization = ] N'allow_web_synchronization' ]
    [ , [ @web_synchronization_url = ] N'web_synchronization_url' ]
    [ , [ @allow_partition_realignment = ] N'allow_partition_realignment' ]
    [ , [ @retention_period_unit = ] N'retention_period_unit' ]
    [ , [ @generation_leveling_threshold = ] generation_leveling_threshold ]
    [ , [ @automatic_reinitialization_policy = ] automatic_reinitialization_policy ]
    [ , [ @conflict_logging = ] N'conflict_logging' ]
[ ; ]

Work example

Creates a new merge publication.

Write a proposed call on paper. Name the target, required permission, expected change, and recovery step before any lab use.

Check your work What can this procedure change or start, and what permission does it need?

Open Microsoft Learn for full syntax, permissions, and details for your version.