locked
CDC Misleading error RRS feed

  • Question

  • I have created CDC for three tables.

    USE <db>
    GO
    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 [TAS].cdc.fn_cdc_get_all_changes_customer_customer (@begin_lsn,@end_lsn,'all')
    GO

    This is working fine. But


    USE tas
    GO
    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 [TAS].cdc.fn_cdc_get_all_changes_vehicle_vehicle (@begin_lsn,@end_lsn,'all')
    GO

     

    its giving an error

    Msg 313, Level 16, State 3, Line 5
    An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_all_changes_ ... .

    i do not find any issue with it. can anybody explains me why ?

     

    Thanks.

    Tuesday, May 3, 2011 7:25 AM

Answers

  • Hi Chakradhar Masineni,

    The issue will raise while you call the function with an invalid LSN range: 
    cdc.fn_cdc_get_all_changes_capture_instance ( from_lsn , to_lsn , '<row_filter_option>' )
    
    <row_filter_option> ::=
    { all
     | all update old
    }
    
    
    For example:
    • The value of from_lsn is null.
    • The value of to_lsn is null.
    • Both of from_lsn and to_lsn are null.
    • The value of from_lsn is larger than the value of to_lsn.

    You can check the value of @begin_lsn and @end_lsn by: SELECT @begin_lsn,@end_lsn

    The issue will be tracked for the next release. Please refer to Microsoft Connect about this feedback: http://connect.microsoft.com/SQLServer/feedback/details/341331/poor-error-message-when-invalid-range-passed-to-fn-cdc-get-all-changes
     

    Best Regards,
    Stephanie Lv

    • Marked as answer by Stephanie Lv Tuesday, May 10, 2011 5:25 AM
    Wednesday, May 4, 2011 8:10 AM