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

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

对当前数据库中指定的源表和捕获实例禁用变更数据捕获。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

语法Syntax

  
sys.sp_cdc_disable_table   
  [ @source_schema = ] 'source_schema' ,   
  [ @source_name = ] 'source_name'  
  [ , [ @capture_instance = ] 'capture_instance' | 'all' ]  

参数Arguments

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

当前数据库中必须存在 source_schemasource_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_name sysname,无默认值,且不能为 NULL。source_name is sysname, with no default, and cannot be NULL.

当前数据库中必须存在 source_namesource_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

None

备注Remarks

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. 它从变更数据捕获系统表中删除与指定捕获实例相关联的任何行,并将 sys.databases目录视图中的表条目的 is_tracked_by_cdc 列设置为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.

权限Permissions

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

示例Examples

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

USE AdventureWorks2012;  
GO  
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)