Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_cdc_verify_index_name

  No additional text.


Syntax
create procedure sys.sp_cdc_verify_index_name
(
	@source_schema sysname,
	@source_name sysname,
	@index_name sysname
)	
as
begin
	declare @retcode int
		,@is_primary_key bit
		,@is_unique bit
		,@is_disabled bit
	
    set nocount on

	-- Verify that the provided index is an index for the source table
	select @is_primary_key = i.is_primary_key,
		@is_unique = i.is_unique,
		@is_disabled = i.is_disabled
	from [sys].[indexes] i
	where object_id(@source_schema + '.' + @source_name) = i.object_id
	and @index_name = i.name

	if ((@is_primary_key is null) and (@is_unique is null))			
	begin
		raiserror(22928, 16, -1, @index_name, @source_schema, @source_name)
		return 1
	end
	
	-- Verify that the index is either a primary key or a unique index
	if ((@is_primary_key = 0) and (@is_unique = 0))			
	begin
		raiserror(22929, 16, -1, @index_name, @source_schema, @source_name)
		return 1
	end
	
	-- Verify that the index is not currently disabled
	if (@is_disabled = 1) 	
	begin
		raiserror(22980, 16, -1, @index_name, @source_schema, @source_name)
		return 1
	end
	
	-- Verify that the index does not contain nullable columns
	if exists
		(	select *
			from [sys].[indexes] i
			inner join [sys].[index_columns] ic
				on i.object_id = ic.object_id and
				   i.index_id = ic.index_id
			inner join [sys].[columns] c
				on ic.column_id = c.column_id and
				   ic.object_id = c.object_id
			where i.name = @index_name
			and   c.is_nullable = 1	
			and   c.object_id = object_id(@source_schema + '.' + @source_name)
		)
	begin
		raiserror(22838, 16, -1, @index_name, @source_schema, @source_name)
		return 1
	end
	
	return 0
end

 
Last revision 2008RTM
See also

  sp_cdc_enable_table_internal (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