sp_addpublication_snapshot (T-SQL)
Creates a Snapshot Agent.
Syntax
sp_addpublication_snapshot [@publication =] 'publication'
[,[@frequency_type =] frequency_type]
[,[@frequency_interval =] frequency_interval]
[,[@frequency_subday =] frequency_subday]
[,[@frequency_subday_interval =] frequency_subday_interval]
[,[@frequency_relative_interval =] frequency_relative_interval]
[,[@frequency_recurrence_factor =] frequency_recurrence_factor]
[,[@active_start_date =] active_start_date]
[,[@active_end_date =] active_end_date]
[,[@active_start_time_of_day =] active_start_time_of_day]
[,[@active_end_time_of_day =] active_end_time_of_day]
Arguments
- [@publication =] 'publication'
- Is the name of the publication. publication is sysname, with no default.
- [@frequency_type =] frequency_type
- Is frequency with which the Snapshot Agent is applied. frequency_type is int, and can be one of these values.
Value |
Description |
1 |
Once |
4 (default) |
Daily |
8 |
Weekly |
10 |
Monthly |
20 |
Monthly, relative to the frequency interval |
40 |
When SQL Server Agent starts |
- [@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, which means daily.
- [@frequency_subday =] frequency_subday
- Is the units for freq_subday_interval. 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, which means every 5 minutes.
- [@frequency_relative_interval =] frequency_relative_interval
- Is the date the Snapshot Agent runs. frequency_relative_interval is int, with a default of 1.
- [@frequency_recurrence_factor =] frequency_recurrence_factor
- Is the recurrence factor used by frequency_type. frequency_recurrence_factor is int, with a default of 0.
- [@active_start_date =] active_start_date
- Is the date when the Snapshot 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 Snapshot Agent stops being scheduled, formatted as YYYYMMDD. active_end_date is int, with a default of 99991231, which means December 31, 9999.
- [@active_start_time_of_day =] active_start_time_of_day
- Is the time of day when the Snapshot 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 Snapshot 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.
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_addpublication_snapshot is used in snapshot, transactional, and merge replication.
Permissions
Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_addpublication_snapshot.
See Also
System Stored Procedures
(c) 1988-98 Microsoft Corporation. All Rights Reserved.