I'm using SQL Server 2014 (SP2).
I have enabled CDC on a table. I then want to view all that has happened in the past 24 hours so I'm using the below:
DECLARE @begin_time DATETIME, @end_time DATETIME, @begin_lsn BINARY(10), @end_lsn BINARY(10);
SELECT @begin_time = GETDATE()-1, @end_time = GETDATE();
SELECT @begin_lsn = sys.fn_cdc_map_time_to_lsn('smallest greater than', @begin_time);
SELECT @end_lsn = sys.fn_cdc_map_time_to_lsn('largest less than or equal', @end_time);
SELECT *
FROM [MyDatabase].cdc.fn_cdc_get_all_changes_dbo_MyTable(@begin_lsn,@end_lsn,'all')
GO
But I keep receiving the below error:
An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_all_changes_ ... .
However ,the above function is system generated when I enabled CDC and only contains 3 parameters:
ALTER function [cdc].[fn_cdc_get_all_changes_dbo_MyTable]
( @from_lsn binary(10),
@to_lsn binary(10),
@row_filter_option nvarchar(30)
)
Why is the function not working?