Strange CDC error on fn_cdc_get_net_changes

  • I'm having a very strange error when requesting data from a ..._CT table.

    On performing this query:

    SELECT THE_ID,SUB_GEB_ID,SUB_CODE

    FROM cdc.fn_cdc_get_net_changes_dbo_ABL_THE_GEBR (0X0000006500013BFE0002,0X000000660000C2C6001D, N'all')

    where __$operation in (2)

    I get an empty resultset, no problem, but when I do the same query, without the last field in the select clause I get an error.

    The query:

    SELECT THE_ID,SUB_GEB_ID

    FROM cdc.fn_cdc_get_net_changes_dbo_ABL_THE_GEBR (0X0000006500013BFE0002,0X000000660000C2C6001D, N'all')

    where __$operation in (2)

    produces:

    Msg 313, Level 16, State 3, Line 1

    An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_net_changes_ ... .

    The two fields I select form the unique key in the source table.

    Im working with sqlserver 2008 SP1 64bit

    Any information is apprecciated,

    Thanks,

    Marc

  • I know the OP probably doesn't need an answer any more, but for anyone who has a similar issue and ends up finding this question:

    The message text 'An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_net_changes_' is very misleading or you could even call it incorrect. It means the value you've specified for @from_lsn and/or @to_lsn is invalid or out-of-bounds. Usually the value specified for @from_lsn is before what is still available for this particular source table (the cleanup process has deleted the rows you intended to read).

    The smallest lsn available for a capture instance can be found by calling:

    declare @min_lsn binary(10);

    select @min_lsn = sys.fn_cdc_get_min_lsn('dbo_yourtable');

    where 'dbo_yourtable' should be replaced by the name of your capture instance of course.

    The highest lsn for any capture instance can be found from:

    declare @max_lsn binary(10);

    select @mx_lsn = sys.fn_cdc_get_max_lsn();

    As you can see, the min_lsn may be different per capture instance, whereas the max_lsn is the same for all capture instances.



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply