CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)

 

Updated: August 8, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Interprets the SYS_CHANGE_COLUMNS value that is returned by the CHANGETABLE(CHANGES …) function. This enables an application to determine whether the specified column is included in the values that are returned for SYS_CHANGE_COLUMNS.

Topic link icon Transact-SQL Syntax Conventions

  
CHANGE_TRACKING_IS_COLUMN_IN_MASK ( column_id , change_columns )  

column_id
Is the ID of the column that is being checked. The column ID can be obtained by using the COLUMNPROPERTY function.

change_columns
Is the binary data from the SYS_CHANGE_COLUMNS column of the CHANGETABLE data.

bit

CHANGE_TRACKING_IS_COLUMN_IN_MASK returns the following values.

Return valueDescription
0The specified column is not in the change_columns list.
1The specified column is in the change_columns list.

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.

The following example determines whether the Salary column of the Employees table was updated. The COLUMNPROPERTY function returns the column ID of the Salary column. 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);  

Change Tracking Functions (Transact-SQL)
CHANGETABLE (Transact-SQL)
Track Data Changes (SQL Server)

Community Additions

ADD
Show: