sp_addsubscriber (T-SQL)
Adds a new Subscriber.
Syntax
sp_addsubscriber [@subscriber =] 'subscriber' [,[@type =] type]
    [,[@login =] 'login'] [,[@password =] 'password']
    [,[@commit_batch_size =] commit_batch_size]
    [,[@status_batch_size =] status_batch_size]
    [,[@flush_frequency =] flush_frequency]
    [,[@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]
    [,[@description =] 'description'] [,[@security_mode =] security_mode]
    [,[@encrypted_password =] encrypted_password]
Arguments
- [@subscriber =] 'subscriber'
- Is the name of the server to be added as a valid Subscriber to this server’s publications. subscriber is sysname, with no default.
- [@type =] type
- Is the type of Subscriber. type is tinyint, and can be one of these values.
  
| Value | Description |  
| 0 (default) | Microsoft® SQL Server™ Subscriber |  
| 1 | ODBC data source server |  
| 2 | Microsoft Jet database |  
| 3 | OLE DB provider |  
 
 
-  [@login =] 'login'
- Is the login ID for SQL Server Authentication. login is sysname, with a default of sa.
- [@password =] 'password
- Is the password for SQL Server Authentication. password is sysname, with a default of NULL.
- [@commit_batch_size =] commit_batch_size
- Is not used in SQL Server 7.0. Supported for backward compatibility only.
- [@status_batch_size =] status_batch_size
- Is not used in SQL Server 7.0. Supported for backward compatibility only.
- [@flush_frequency =] flush_frequency 
- Is not used in SQL Server 7.0. Supported for backward compatibility only.
- [@frequency_type =] frequency_type
- Is the frequency with which to schedule the Distribution Agent. frequency_type is int, and can be one of these values.
  
| Value | Description |  
| 1 | One time |  
| 2 | On demand |  
| 4 | Daily |  
| 8 | Weekly |  
| 16 | Monthly |  
| 32 | Monthly relative |  
| 64 (default) | Autostart |  
| 124 | Recurring |  
 
 
- [@frequency_interval =] frequency_interval 
- Is the value to apply to the frequency set by frequency_type. frequency_interval is int, with a default of 1.
- [@frequency_relative_interval =] frequency_relative_interval
- Is the date of the Distribution Agent. This parameter is used when frequency_type is set to 32 (monthly relative). frequency_relative_interval is int, and can be one of these values.
  
| Value | Description |  
| 1 (default) | First |  
| 2 | Second |  
| 4 | Third |  
| 8 | Fourth |  
| 16 | Last |  
 
 
- [@frequency_recurrence_factor =] frequency_recurrence_factor 
- Is the recurrence factor used by frequency_type. frequency_recurrence_factor is int, with a default of 0.
- [@frequency_subday =] frequency_subday 
- Is how often to reschedule during the defined period. frequency_subday is int, and can be one of these values.
  
| Value | Description |  
| 1 | Once |  
| 2 | Second |  
| 4 (default) | Minute |  
| 8 | Hour |  
 
 
- [@frequency_subday_interval =] frequency_subday_interval
- Is the interval for frequency_subday. frequency_subday_interval is int, with a default of 5.
- [@active_start_time_of_day =] active_start_time_of_day
- Is the time of day when the Distribution Agent is first scheduled, formatted as HHMMSS. active_start_time_of_day is int, with a default of 0.
- [@active_end_time_of_day =] active_end_time_of_day
- Is the time of day when the Distribution Agent stops being scheduled, formatted as HHMMSS. active_end_time_of_day is int, with a default of 235959, which means 11:59:59 P.M. as measured on a 24-hour clock. 
- [@active_start_date =] active_start_date
- Is the date when the Distribution Agent is first scheduled, formatted as YYYYMMDD. active_start_date is int, with a default of 0.
- [@active_end_date =] active_end_date
- Is the date when the Distribution Agent stops being scheduled, formatted as YYYYMMDD. active_end_date is int, with a default of 99991231, which means December 31, 9999.
- [@description =] 'description'
- Is a text description of the Subscriber. description is nvarchar(255), with a default of NULL. When upgrading, existing MSsubscriber_info tables are modified to include a description column, which is initialized to SQL Server version 7.0.
- [@security_mode =] security_mode
- Is the implemented security mode. security_mode is int, with a default of 1. 0 specifies SQL Server Authentication. 1 specifies Windows NT Authentication. 
- [@encrypted_password =] encrypted_password
- For internal use only.
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_addsubscriber is used in snapshot, transactional, and merge replication.
sp_addsubscriber writes to the MSsubscriber_info table in the distribution database. 
Permissions
Only members of the sysadmin fixed server role can execute sp_addsubscriber.
See Also
  
(c) 1988-98 Microsoft Corporation.  All Rights Reserved.