Transact-SQL Reference

sp_replicationdboption

Sets a replication database option for the current database. This stored procedure is executed at the Publisher on any database.

Syntax

sp_replicationdboption [ @dbname = ] 'db_name' ,
    
[ @optname = ] 'optname' ,
    
[ @value = ] 'value'
    [ , [ @ignore_distributor = ] ignore_distributor ]
    [ , [ @from_scripting = ] from_scripting ]

Arguments

[@dbname =] 'dbname'

Is the database to drop. db_name is sysname, with no default.

[@optname =] 'optname'

Is the option to create or drop. optname is sysname, and can be one of these values.

Value Description
merge publish Database can be used for merge publications.
publish Database can be used for other types of publications.

[@value =] 'value'

Is whether to create or drop the given replication database option. value is sysname, and can be true or false. false also drops the merge subscriptions.

[@ignore_distributor =] ignore_distributor

Indicates whether this stored procedure is executed without connecting to the Distributor. ignore_distributor is bit, with a default of 0, meaning the Distributor should be connected to and updated with the new status of the publishing database. The value 1 should be specified only if the Distributor is inaccessible and sp_replicationdboption is being used to disable publishing.

[@from_scripting =] from_scripting

For internal use only.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_replicationdboption is used in snapshot replication, transactional replication, and merge replication.

This procedure creates or drops specific replication system tables, security accounts, and so on, depending on the options given. Sets the corresponding category bit in the master.sysdatabases system table and creates the necessary system tables.

Permissions

Only members of the sysadmin fixed server role can execute sp_replicationdboption.

See Also

sysdatabases

System Stored Procedures