Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_cdc_change_job_internal

  No additional text.


Syntax
create procedure sys.sp_cdc_change_job_internal
(
	@job_type nvarchar(20),
	@maxtrans int,
	@maxscans int,
	@continuous bit,
	@pollinginterval bigint,
	@retention bigint,
	@threshold bigint
)
with execute as 'dbo'
as
begin
    set nocount on

    declare @db_name sysname

    set @db_name = db_name()

    if object_id('msdb.dbo.cdc_jobs') is null
    begin
        raiserror(22993, 16, -1, @db_name)
        return(1)
    end

    if not exists
    (
		select * from msdb.dbo.cdc_jobs
		where database_id = db_id()
		and job_type = @job_type
	)
    begin
        raiserror(22997, 16, -1, @job_type)
        return(1)
    end

    if (@job_type = N'capture') and ((@retention is not null) or (@threshold is not null))
    begin
        raiserror(22995, 16, -1)
        return(1)
    end

    if (@job_type = N'cleanup') and
		((	@pollinginterval is not null) or
		 (	@maxtrans is not null) or
 		 (	@maxscans is not null) or
		 (  @continuous is not null )) 	
    begin
        raiserror(22996, 16, -1)
        return(1)
    end

    if (@maxtrans is not null) and (@maxtrans <= 0)
    begin
        raiserror(22991, 16, -1)
        return(1)
    end

    if (@maxscans is not null) and (@maxscans <= 0)
    begin
        raiserror(22970, 16, -1)
        return(1)
    end

    -- 24 hour maximum on polling interval
    if (@pollinginterval is not null) and ((@pollinginterval > (60*60*24)) or (@pollinginterval < 0))
	begin
		raiserror(22990, 16, -1)
		return(1)
	end		

    -- if non null, retention must be greater than 0 and less than or equal to 52594800
    if (@retention is not null) and ((@retention <= 0) or (@retention > 52594800))
	begin
		raiserror(22994, 16, -1)
		return(1)
	end
	
    -- if non null, threshold must be greater than 0
    if (@threshold is not null) and (@threshold <= 0)
	begin
		raiserror(22850, 16, -1)
		return(1)
	end
	
	-- if @continuous = 0, @pollinginterval is automatically
	-- set to 0
	if (@continuous = 0)
		set @pollinginterval = 0
		
	-- if @pollinginterval > 0, @continuous is automatically
	-- set to 1
	if (@pollinginterval > 0)
		set @continuous = 1		

	-- if @continuous = 0, @pollinginterval is automatically
	-- set to 0
	if (@continuous = 0)
		set @pollinginterval = 0
		
	-- if @pollinginterval > 0, @continuous is automatically
	-- set to 1
	if (@pollinginterval > 0)
		set @continuous = 1		
		
	if (@job_type = N'capture')
	begin
		update msdb.dbo.cdc_jobs
		set pollinginterval = @pollinginterval
		where database_id = db_id()
		and job_type = @job_type
		and @pollinginterval is not null

		update msdb.dbo.cdc_jobs
		set continuous = @continuous
		where database_id = db_id()
		and job_type = @job_type
		and @continuous is not null

		update msdb.dbo.cdc_jobs
		set maxtrans = @maxtrans
		where database_id = db_id()
		and job_type = @job_type
		and @maxtrans is not null
		
		update msdb.dbo.cdc_jobs
		set maxscans = @maxscans
		where database_id = db_id()
		and job_type = @job_type
		and @maxscans is not null
	end	
	else
	begin
		update msdb.dbo.cdc_jobs
		set retention = @retention
		where database_id = db_id()
		and job_type = @job_type
		and @retention is not null
		
		update msdb.dbo.cdc_jobs
		set threshold = @threshold
		where database_id = db_id()
		and job_type = @job_type
		and @threshold is not null
	end
	
    return(0)
end

 
Last revision 2008RTM
See also

  sp_cdc_change_job (Procedure)
sp_MSdrop_cdc (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