CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database

解释 CHANGETABLE (CHANGES ... ) 函数返回的 SYS_CHANGE_COLUMNS 值。Interprets the SYS_CHANGE_COLUMNS value that is returned by the CHANGETABLE(CHANGES ...) function. 这使应用程序能够确定指定的列是否包含在为 SYS_CHANGE_COLUMNS 返回的值中。This enables an application to determine whether the specified column is included in the values that are returned for SYS_CHANGE_COLUMNS.

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

语法Syntax

  
CHANGE_TRACKING_IS_COLUMN_IN_MASK ( column_id , change_columns )  

参数Arguments

column_idcolumn_id
是正在被检查的列的 ID。Is the ID of the column that is being checked. 可以使用 COLUMNPROPERTY 函数获取列 ID。The column ID can be obtained by using the COLUMNPROPERTY function.

change_columnschange_columns
CHANGETABLE 数据的 SYS_CHANGE_COLUMNS 列中的二进制数据。Is the binary data from the SYS_CHANGE_COLUMNS column of the CHANGETABLE data.

返回类型Return Type

bitbit

返回值Return Values

CHANGE_TRACKING_IS_COLUMN_IN_MASK 返回下列值。CHANGE_TRACKING_IS_COLUMN_IN_MASK returns the following values.

返回值Return value 说明Description
00 指定的列不在 change_columns 列表中。The specified column is not in the change_columns list.
11 指定的列位于 change_columns 列表。The specified column is in the change_columns list.

备注Remarks

CHANGE_TRACKING_IS_COLUMN_IN_MASK 不会执行任何检查来验证 column_id 值,或者 change_columns 参数是从获取 column_id 的表中获取的。CHANGE_TRACKING_IS_COLUMN_IN_MASK does not perform any checks to validate the column_id value or that the change_columns parameter was obtained from the table from which the column_id was obtained.

示例Examples

下面的示例确定是否已更新 Salary 表的 Employees 列。The following example determines whether the Salary column of the Employees table was updated. COLUMNPROPERTY函数将返回列的列 ID SalaryThe COLUMNPROPERTY function returns the column ID of the Salary column. 必须使用 CHANGETABLE 作为数据源将 @change_columns 局部变量设置为查询的结果。The @change_columns local variable must be set to the results of a query by using CHANGETABLE as a data source.

SET @SalaryChanged = CHANGE_TRACKING_IS_COLUMN_IN_MASK  
    (COLUMNPROPERTY(OBJECT_ID('Employees'), 'Salary', 'ColumnId')  
    ,@change_columns);  

另请参阅See Also

变更跟踪函数 (Transact-SQL) Change Tracking Functions (Transact-SQL)
CHANGETABLE (Transact-SQL) CHANGETABLE (Transact-SQL)
跟踪数据更改 (SQL Server)Track Data Changes (SQL Server)