Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_cdc_get_capture_instances

  No additional text.


Syntax
create procedure sys.sp_cdc_get_capture_instances  				
(														
	@source_schema sysname = null,
	@source_name sysname = null
)
with execute as 'dbo'
as
begin
	set nocount on
	
	declare @capture_instance sysname
	
	if ((@source_name is null)   or (@source_name = N''))   and
	   ((@source_schema is null) or (@source_schema = N''))
	begin
	
		-- All capture instances are to be returned
		insert into #capture_instances
		select capture_instance, object_id
		from [cdc].[change_tables]
		
		return 0
		
	end
	
	-- This is a request for capture information on a specific source table	
	if ((@source_name is null) or (@source_schema is null) or
		(@source_name = N'')   or (@source_schema = N''))
	begin
		raiserror(22972, 16, -1)
		return 1
	end
		
	if not exists (
		select object_id
		from sys.objects
		where @source_schema = schema_name(schema_id)
		and   @source_name   = object_name(object_id)
	)
	begin
		raiserror(22981, 16, -1)
		return 1
	end
		
	select @capture_instance = null
		
	select top 1 @capture_instance = capture_instance
	from [cdc].[change_tables] with (index = source_object_id_idx)
	where object_schema_name(source_object_id) = @source_schema
	and   object_name(source_object_id) = @source_name
		
	if (@capture_instance is null)
	begin
		raiserror(22985, 16, -1, @source_schema, @source_name)
		return 1
	end
	
	-- Return capture instances associated with the named source table
	insert into #capture_instances
	select capture_instance, object_id
	from [cdc].[change_tables] with (index = source_object_id_idx)
	where object_schema_name(source_object_id) = @source_schema
	and   object_name(source_object_id) = @source_name
	
	return 0
end

 
Last revision 2008RTM
See also

  sp_cdc_generate_wrapper_function (Procedure)
sp_cdc_help_change_data_capture (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