Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MScdc_capture_job

  No additional text.


Syntax

create procedure [sys].[sp_MScdc_capture_job]
as
begin
	set nocount on
	declare @retcode int
           ,@pollinginterval bigint
           ,@continuous bit
           ,@maxtrans int
           ,@maxscans int
           ,@db_name sysname

	set @db_name = db_name()

    
    -- security check - should be dbo or sysadmin
    
    exec @retcode = sp_MSreplcheck_publish
    if @@ERROR != 0 or @retcode != 0
	begin
		raiserror(22864, 16, -1, @db_name)
		return 1
	end	

    
    -- security check
    -- Has to be executed from cdc enabled db
    
	if not exists (select * from sys.databases where database_id = db_id() and is_cdc_enabled = 1)
	begin
		RAISERROR(22901, 16, -1, @db_name)
		return (1)
	end

	
	-- Insure that transactional replication is not also trying to scan the log
	
	exec @retcode = [sys].[sp_MScdc_tranrepl_check]
	if @retcode <> 0 or @@error <> 0
	begin
		raiserror(22864, 16, -1, @db_name)
		return 1
	end	
	
	-- Get job parameters for msdb.cdc_jobs
	exec @retcode = sys.sp_cdc_get_job_parameters
		@pollinginterval output
		,@continuous  output
		,@maxscans output
		,@maxtrans output

	if (@@error <> 0) or (@retcode <> 0)
	begin
		raiserror(22864, 16, -1, @db_name)
		return 1
	end
	
	if @continuous is null
		set @continuous = 1
			
	if @maxtrans is null
		set @maxtrans = 500
		
	if @maxscans is null
		set @maxscans = 10
			
    if @pollinginterval is null
		if @continuous = 1
			set @pollinginterval = 5
		else
			set @pollinginterval = 0

    exec @retcode = sp_cdc_scan
		 @pollinginterval = @pollinginterval
		,@continuous = @continuous
		,@maxtrans = @maxtrans
        ,@maxscans = @maxscans
        ,@is_from_job = 1
	
	if @retcode <> 0 or @@error <> 0
	begin
		raiserror(22864, 16, -1, @db_name)
		return 1
	end
		
	return 0
END

 
Last revision 2008RTM
See also

  sp_cdc_add_job_internal (Procedure)
sp_cdc_get_job_parameters (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