sp_adddistpublisher
Configures a Publisher to use a specified distribution database. This stored procedure is executed at the Distributor on any database. Note that the stored procedures sp_adddistributor and sp_adddistributiondb must have been run prior to using this stored procedure.
Syntax
sp_adddistpublisher [ @publisher = ] 'publisher'
[ , @distribution_db = ] 'distribution_db'
[ , [ @security_mode = ] security_mode ]
[ , [ @login = ] 'login' ]
[ , [ @password = ] 'password' ]
{ , [ @working_directory = ] 'working_directory' }
[ , [ @trusted = ] 'trusted' ]
[ , [ @encrypted_password = ] encrypted_password ]
[ , [ @thirdparty_flag = ] thirdparty_flag ]
Arguments
[@publisher = ] 'publisher'
Is the Publisher name. publisher is sysname, with no default.
[@distribution_db = ] 'distribution_db'
Is the name of the distribution database. distributor_db is sysname, with no default. This parameter is used by replication agents to connect to the Publisher.
[@security_mode = ] security_mode
Is the implemented security mode. This parameter is used by replication agents to connect to the Publisher. security_mode is int, and can be one of these values.
Value | Description |
---|---|
0 | Replication agents at the Distributor use SQL Server Authentication to connect to the Publisher. |
1 | Replication agents at the Distributor use Windows Authentication to connect to the Publisher. |
NULL (default) | System will change the value to 0 if the server (Distributor) is running on the Windows® 95 or Windows 98 operating system. System will change the value to 1 if the server (Distributor) is on a Windows NT® 4.0 or Windows 2000 operating system. |
[@login = ] 'login'
Is the login. This parameter is required if security_mode is 0. login is sysname, with a default of sa. This parameter is used by replication agents to connect to the Publisher.
[@password = ] 'password']
Is the password. password is sysname, with a default of NULL. This parameter is used by replication agents to connect to the Publisher.
[@working_directory = ] 'working_directory'
Is the name of the working directory used to store data and schema files for the publication. working_directory is nvarchar(255). The name should be specified in UNC format.
[@trusted = ] 'trusted'
Is when the remote Publisher uses the same password as the local Distributor. trusted is nvarchar(5), and can be one of these values.
Value | Description |
---|---|
True | One trusted login mapping is added: sa to distributor_admin. Because the mapping is trusted, no password is needed at the remote Publisher to connect to the Distributor. |
False | One nontrusted mapping is added: distributor_admin to distributor_admin. A password is needed at the remote Publisher to make a connection. |
NULL (default) | If the distribution Publisher is local, the system will change the value to false (nontrusted). Any password set for the Distributor is also set for the local distribution Publisher (linked server connection back to local Distributor). If the distribution Publisher is remote, the system will change the value to true (trusted) and no password is needed at the remote Publisher. If the user changes the distributor_admin password directly, instead of using sp_changedistributor_password, the local link is broken. |
[@encrypted_password = ] encrypted_password
Is when the password is encrypted. encrypted_password is bit, with a default of 0. If 1, password is stored in encrypted form.
[@thirdparty_flag = ] thirdparty_flag
Is when the Publisher is Microsoft® SQL Server™. thirdparty_flag is bit, and can be one of these values.
Value | Description |
---|---|
0 (default) | Microsoft SQL Server database. |
1 | Database other than SQL Server. |
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_adddistpublisher is used by snapshot replication, transactional replication, and merge replication.
Permissions
Only members of the sysadmin fixed server role can execute sp_adddistpublisher.