This scalar function uses the Change Table name, a field name from the change table and the _Change-FieldMap column as inputs and returns the value as either 0 or 1. If the value returned is 1, it indicates that the corresponding field value is changed in the FieldMap column. If the value returned is 0, it indicates that the corresponding field has not changed in the FieldMap column.
For example, if pub.CDC_ch1 is the Change table and it has fields F1, F2, F3, F4, and F5 and the _Change-FieldMap column of the Change Tracking table contains the values as 11001, the following queries to the CDC_get_changed_columns show whether there was a change in the FieldMap column value.
Note: This function is used on a query that accesses the CDC Change Tracking table, which contains the CDC field map column.
The above query returns a value of 0 and indicates that the corresponding field value is not changed in the FieldMap column. The following example illustrates this:
SELECT "_operation" FROM pub."_CDC-Change-Tracking", WHERE CDC_is_column_changed(“pub"."CDC_mytb14", mynum, _Change-FieldMap") = 1;
Notes
SQL returns an error unless the table name given as the first parameter to the function is a Change table.
The column name given as the second parameter must be a column in that Change table. Otherwise, SQL returns an error