sys.sp_cdc_disable_table (Transact-SQL)sys.sp_cdc_disable_table (Transact-SQL)

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

对当前数据库中指定的源表和捕获实例禁用变更数据捕获。Disables change data capture for the specified source table and capture instance in the current database. 并非在 MicrosoftMicrosoftSQL ServerSQL Server的每个版本中均提供变更数据捕获功能。Change data capture is not available in every edition of MicrosoftMicrosoftSQL ServerSQL Server. 有关 SQL ServerSQL Server各版本支持的功能列表,请参阅 SQL Server 2016 各个版本支持的功能For a list of features that are supported by the editions of SQL ServerSQL Server, see Features Supported by the Editions of SQL Server 2016.

主题链接图标 TRANSACT-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions


  [ @source_schema = ] 'source_schema' ,   
  [ @source_name = ] 'source_name'  
  [ , [ @capture_instance = ] 'capture_instance' | 'all' ]  


[ @source_schema = ] 'source\_schema' 是在其中包含源表的名称。[ @source_schema = ] 'source\_schema' Is the name of the schema in which the source table is contained. source_schemasysname,无默认值,且不能为 NULL。source_schema is sysname, with no default, and cannot be NULL.

source_schema必须存在于当前数据库。source_schema must exist in the current database.

[ @source_name = ] 'source\_name' 是其变更数据捕获是源表的要禁用的名称。[ @source_name = ] 'source\_name' Is the name of the source table from which change data capture is to be disabled. source_namesysname,无默认值,且不能为 NULL。source_name is sysname, with no default, and cannot be NULL.

source_name必须存在于当前数据库。source_name must exist in the current database.

[ @capture_instance = ] 'capture\_instance' | 'all' 是要为指定的源表禁用的捕获实例的名称。[ @capture_instance = ] 'capture\_instance' | 'all' Is the name of the capture instance to disable for the specified source table. capture_instancesysname且不能为 NULL。capture_instance is sysname and cannot be NULL.

当指定 all 时,所有捕获实例的定义source_name处于禁用状态。When 'all' is specified, all capture instances defined for source_name are disabled.

返回代码值Return Code Values

0 (成功) 或1 (失败)0 (success) or 1 (failure)

结果集Result Sets



sys.sp_cdc_disable_table删除变更数据捕获更改表和系统函数与指定的源表和捕获实例相关联。sys.sp_cdc_disable_table drops the change data capture change table and system functions associated with the specified source table and capture instance. 删除任何与来自变更数据捕获系统表和集的指定的捕获实例关联的行is_tracked_by_cdc列中的表项sys.tables目录视图为 0。It deletes any rows associated with the specified capture instance from the change data capture system tables and sets the is_tracked_by_cdc column for the table entry in the sys.tables catalog view to 0.


要求的成员身份db_owner固定的数据库角色。Requires membership in the db_owner fixed database role.


下例对 HumanResources.Employee 表禁用了变更数据捕获。The following example disables change data capture for the HumanResources.Employee table.

USE AdventureWorks2012;  
EXECUTE sys.sp_cdc_disable_table   
    @source_schema = N'HumanResources',   
    @source_name = N'Employee',  
    @capture_instance = N'HumanResources_Employee';  

请参阅See Also

sys.sp_cdc_enable_table (Transact-SQL)sys.sp_cdc_enable_table (Transact-SQL)