Skip to content

Latest commit

 

History

History
69 lines (53 loc) · 3.07 KB

change-tracking-is-column-in-mask-transact-sql.md

File metadata and controls

69 lines (53 loc) · 3.07 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)
CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)
rwestMSFT
randolphwest
08/08/2016
sql
system-objects
reference
CHANGE_TRACKING_IS_COLUMN_IN_MASK_TSQL
CHANGE_TRACKING_IS_COLUMN_IN_MASK
change tracking [SQL Server], CHANGE_TRACKING_IS_COLUMN_IN_MASK
CHANGE_TRACKING_IS_COLUMN_IN_MASK
TSQL
=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

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.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

  
CHANGE_TRACKING_IS_COLUMN_IN_MASK ( column_id , change_columns )  

Arguments

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.

Return Type

bit

Return Values

CHANGE_TRACKING_IS_COLUMN_IN_MASK returns the following values.

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

Remarks

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

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);  

See Also

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