Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSadd_subscriber_schedule

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_MSadd_subscriber_schedule
(
    @publisher sysname,
    @subscriber sysname,
    @agent_type smallint = 0,   -- 0 for distribution agent, 1 for merge agent
    @frequency_type int = 4,
    @frequency_interval int = 1,
    @frequency_relative_interval int = 1,
    @frequency_recurrence_factor int = 0,
    @frequency_subday int = 4,
    @frequency_subday_interval int = 5,
    @active_start_time_of_day int = 0,
    @active_end_time_of_day int = 235959,
    @active_start_date int = 0,
    @active_end_date int = 99991231
)
AS
begin
   set nocount on
   declare @retcode int

    
    -- security check
    -- only sysadmin can execute this
    
    if (isnull(is_srvrolemember('sysadmin'),0) = 0)
    begin
        raiserror(21089, 16, -1)
        return (1)
    end
    
    -- security check
    -- Has to be executed from distribution database
    
    if (sys.fn_MSrepl_isdistdb (db_name()) != 1)
    begin
        raiserror(21482, 16, -1, 'sp_MSadd_subscriber_schedule', 'distribution')
        return (1)
    end

   	/* Add the subscriber to dbo.sysservers as a RPC server, if it does not
  	** already exist.
   	*/
   	if not exists (select * from  master.dbo.sysservers where  UPPER(srvname) = UPPER(@subscriber))
	begin
      	DECLARE @upper_subscriber sysname

		SELECT @upper_subscriber = UPPER(@subscriber collate database_default)
		
        exec @retcode = dbo.sp_addserver @upper_subscriber
    	if @retcode <> 0
    		return 1
    end

	/* only insert if it doesn't exist */
	if not exists (select *
				from MSsubscriber_schedule
				where UPPER(publisher) = UPPER(@publisher)
					and UPPER(subscriber) = UPPER(@subscriber)
					and agent_type = @agent_type)
	begin
           insert MSsubscriber_schedule (publisher, subscriber, agent_type,
		      frequency_type, frequency_interval, frequency_relative_interval,
		      frequency_recurrence_factor, frequency_subday, frequency_subday_interval,
		      active_start_time_of_day, active_end_time_of_day, active_start_date,
		      active_end_date)
		
		      values (@publisher, @subscriber, @agent_type,
		      @frequency_type, @frequency_interval, @frequency_relative_interval,
		      @frequency_recurrence_factor, @frequency_subday, @frequency_subday_interval,
		      @active_start_time_of_day, @active_end_time_of_day, @active_start_date,
		      @active_end_date)
		   if @@error <> 0
		      return 1
	end
end

 
Last revision 2008RTM
See also

  sp_addsubscriber_schedule (Procedure)
sp_instdist (Procedure)
sp_MSrepl_addsubscriber (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash