sys.sp_addsubscription
Adds a subscription to a publication and sets the Subscriber status. This stored procedure runs at the Publisher on the publication database.
What changes
- Input
- Not stated in the Microsoft summary.
- Output or change
- Adds a subscription to a publication and sets the Subscriber status. This stored procedure runs at the Publisher on the publication database.
Syntax at a glance
sys.sp_addsubscription
[ @publication = ] N'publication'
[ , [ @article = ] N'article' ]
[ , [ @subscriber = ] N'subscriber' ]
[ , [ @destination_db = ] N'destination_db' ]
[ , [ @sync_type = ] N'sync_type' ]
[ , [ @status = ] N'status' ]
[ , [ @subscription_type = ] N'subscription_type' ]
[ , [ @update_mode = ] N'update_mode' ]
[ , [ @loopback_detection = ] N'loopback_detection' ]
[ , [ @frequency_type = ] frequency_type ]
[ , [ @frequency_interval = ] frequency_interval ]
[ , [ @frequency_relative_interval = ] frequency_relative_interval ]
[ , [ @frequency_recurrence_factor = ] frequency_recurrence_factor ]
[ , [ @frequency_subday = ] frequency_subday ]
[ , [ @frequency_subday_interval = ] frequency_subday_interval ]
[ , [ @active_start_time_of_day = ] active_start_time_of_day ]
[ , [ @active_end_time_of_day = ] active_end_time_of_day ]
[ , [ @active_start_date = ] active_start_date ]
[ , [ @active_end_date = ] active_end_date ]
[ , [ @optional_command_line = ] N'optional_command_line' ]
[ , [ @reserved = ] N'reserved' ]
[ , [ @enabled_for_syncmgr = ] N'enabled_for_syncmgr' ]
[ , [ @offloadagent = ] offloadagent ]
[ , [ @offloadserver = ] N'offloadserver' ]
[ , [ @dts_package_name = ] N'dts_package_name' ]
[ , [ @dts_package_password = ] N'dts_package_password' ]
[ , [ @dts_package_location = ] N'dts_package_location' ]
[ , [ @distribution_job_name = ] N'distribution_job_name' ]
[ , [ @publisher = ] N'publisher' ]
[ , [ @backupdevicetype = ] N'backupdevicetype' ]
[ , [ @backupdevicename = ] N'backupdevicename' ]
[ , [ @mediapassword = ] N'mediapassword' ]
[ , [ @password = ] N'password' ]
[ , [ @fileidhint = ] fileidhint ]
[ , [ @unload = ] unload ]
[ , [ @subscriptionlsn = ] subscriptionlsn ]
[ , [ @subscriptionstreams = ] subscriptionstreams ]
[ , [ @subscriber_type = ] subscriber_type ]
[ , [ @memory_optimized = ] memory_optimized ]
[ , [ @subscriber_security_mode = ] subscriber_security_mode ]
[ , [ @subscriber_login = ] N'subscriber_login' ]
[ , [ @subscriber_password = ] N'subscriber_password' ]
[ ; ]
Work example
Adds a subscription to a publication and sets the Subscriber status. This stored procedure runs at the Publisher on the publication database.
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.