You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Columns of data type **image**, **text**, and **ntext** are always assigned a NULL value when **__$operation** = 1 or **__$operation** = 3. Columns of data type **varbinary(max)**, **varchar(max)**, or **nvarchar(max)** are assigned a NULL value when **__$operation** = 3 unless the column changed during the update. When **__$operation** = 1, these columns are assigned their value at the time of the delete. Computed columns that are included in a capture instance always have a value of NULL.
80
80
81
-
Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the value of either @start_time or @end_time parameter is beyond the time of lowest LSN or highest LSN, then execution of generated wrapper functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
81
+
Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the `lsn_value`parameter is beyond the time of lowest LSN or highest LSN, then execution of these functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
82
82
83
83
## Examples
84
84
Several [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] templates are available that show how to use the change data capture query functions. These templates are available on the **View** menu in [!INCLUDE[ssManStudio](../../includes/ssmanstudio-md.md)]. For more information, see [Template Explorer](../../ssms/template/template-explorer.md).
Modifications on the unique identifier of a row will cause `fn_cdc_get_net_changes` to show the initial UPDATE command with a DELETE and then INSERT command instead. This behavior is necessary to track the key both before and after the change.
89
89
90
-
Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the value of either @start_time or @end_time parameter is beyond the time of lowest LSN or highest LSN, then execution of generated wrapper functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
90
+
Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the `lsn_value`parameter is beyond the time of lowest LSN or highest LSN, then execution of these functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
91
91
92
92
## Examples
93
93
The following example uses the function `cdc.fn_cdc_get_net_changes_HR_Department` to report the net changes made to the source table `HumanResources.Department` during a specific time interval.
@@ -122,10 +122,10 @@ SELECT * FROM cdc.fn_cdc_get_net_changes_HR_Department(@from_lsn, @to_lsn, 'all'
|__CDC_STARTLSN|**binary(10)**|The commit LSN of the transaction that is associated with the change. All changes that are committed in the same transaction share the same commit LSN.|
87
87
|__CDC_SEQVAL|**binary(10)**|Sequence value that is used to order the row changes in a transaction.|
88
-
|\<columns from @column_list>|**varies**|The columns that are identified in the *column_list* argument to sp_cdc_generate_wrapper_function when it is called to generate the script that creates the wrapper function.|
88
+
|\<columns from @column_list>|**varies**|The columns that are identified in the *column_list* argument to `sp_cdc_generate_wrapper_function` when it is called to generate the script that creates the wrapper function.|
89
89
|__CDC_OPERATION|**nvarchar(2)**|Operation code that indicates the operation that is required to apply the row to the target environment. It will vary based on the value of the argument *row_filter_option* supplied in the call:<br /><br /> *row_filter_option* = 'all'<br /><br /> 'D' - delete operation<br /><br /> 'I' - insert operation<br /><br /> 'UN' - update operation new values<br /><br /> *row_filter_option* = 'all update old'<br /><br /> 'D' - delete operation<br /><br /> 'I' - insert operation<br /><br /> 'UN' - update operation new values<br /><br /> 'UO' - update operation old values|
90
90
|\<columns from @update_flag_list>|**bit**|A bit flag is named by appending _uflag to the column name. The flag is always set to NULL when \__CDC_OPERATION is 'D', 'I', of 'UO'. When \__CDC_OPERATION is 'UN', it is set to 1 if the update produced a change to the corresponding column. Otherwise, 0.|
Bit flags are then appended to the result set for each column that is identified in the @update_flag_list parameter. For the **all changes** wrapper, the bit flags will always be NULL if __CDC_OPERATION is 'D', 'I', or 'UO'. If \__CDC_OPERATION is 'UN', the flag will be set to 1 or 0, depending on whether the update operation caused a change to the column.
108
108
109
-
The change data capture configuration template 'Instantiate CDC Wrapper TVFs for Schema' shows how to use the sp_cdc_generate_wrapper_function stored procedure to obtain CREATE scripts for all of the wrapper functions for a schema's defined query functions. The template then creates those scripts. For more information about templates, see [Template Explorer](../../ssms/template/template-explorer.md).
109
+
The change data capture configuration template 'Instantiate CDC Wrapper TVFs for Schema' shows how to use the `sp_cdc_generate_wrapper_function` stored procedure to obtain CREATE scripts for all of the wrapper functions for a schema's defined query functions. The template then creates those scripts. For more information about templates, see [Template Explorer](../../ssms/template/template-explorer.md).
110
+
111
+
The wrapper functions `sys.fn_all_changes_<capture_instance>` and `sys.fn_net_changes_<capture_instance>` are dependent on the system functions `cdc.fn_cdc_get_all_changes_<capture_instance>` and `cdc.fn_cdc_get_net_changes_<capture_instance>`. Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the `lsn_value` parameter is beyond the time of lowest LSN or highest LSN, then execution of these functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
> Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the `lsn_value` parameter is beyond the time of lowest LSN or highest LSN, then execution of these functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
The LSN value returned by the function is always greater than the specified value, and no LSN values exist between the two values.
48
48
49
49
To systematically query a stream of change data over time, you can repeat the query function call periodically, each time specifying a new query interval to bound the changes returned in the query. To help insure that no data is lost, the upper bound for the previous query is often used to generate the lower bound for the subsequent query. Because the query interval is a closed interval, the new lower bound must be larger than the previous upper bound, but small enough to ensure no changes have LSN values that lie between this value and the old upper bound. The function `sys.fn_cdc_increment_lsn` is used to obtain this value.
50
-
51
-
Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the value of either @start_time or @end_time parameter is beyond the time of lowest LSN or highest LSN, then execution of generated wrapper functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
52
50
53
51
## Permissions
54
-
Requires membership in the public database role.
52
+
Requires membership in the **public** database role.
55
53
56
54
## Examples
57
55
The following example uses `sys.fn_cdc_increment_lsn` to generate a new lower bound value for a change data capture query based on the upper bound saved from a previous query and saved in the variable `@save_to_lsn`.
@@ -67,12 +65,14 @@ SELECT * from cdc.fn_cdc_get_all_changes_HumanResources_Employee( @from_lsn, @to
67
65
GO
68
66
```
69
67
68
+
> [!NOTE]
69
+
> Error 313 is expected if LSN range supplied is not appropriate when calling `cdc.fn_cdc_get_all_changes_<capture_instance>` or `cdc.fn_cdc_get_net_changes_<capture_instance>`. If the `lsn_value` parameter is beyond the time of lowest LSN or highest LSN, then execution of these functions will return in error 313: `Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function`. This error should be handled by the developer.
0 commit comments