Applies To: SQL Server 2014, SQL Server 2016 Preview
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Returns the column ordinal of the specified column as it appears in the change table associated with the specified capture instance.
Applies to: SQL Server (SQL Server 2008 through current version).
This function is used to identify the ordinal position of a captured column within the change data capture update mask. It is principally used in conjunction with the function sys.fn_cdc_is_bit_set to extract information from the update mask when querying for change data.
The following example obtains the ordinal position of the VacationHours column in the update mask for the HumanResources_Employee capture instance. That value is then used in the call to sys.fn_cdc_is_bit_set to extract information from the returned update mask.
USE AdventureWorks2012; GO DECLARE @VacationHoursOrdinal int; SET @VacationHoursOrdinal = sys.fn_cdc_get_column_ordinal ( 'HumanResources_Employee','VacationHours'); SELECT sys.fn_cdc_is_bit_set(@VacationHoursOrdinal, __$update_mask) as 'VacationHoursChanged', * FROM cdc.fn_get_net_changes_HumanResources_Employee (@from_lsn, @to_lsn, 'all with mask'); GO