Quantcast
Channel: Windows Performance Toolkit forum
Viewing all articles
Browse latest Browse all 1161

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

$
0
0

Hello all,

Iam trying to learn how to use CDC, and trying to follow the example.. but still get the error when trying to view data in _CT table.  Could you please help.

below are my steps..

CreateDatabase CDCORigin;

createtable dbo.customer

(

idintidentitynotnull

,namevarchar(50)notnull

,statevarchar(2)notnull

,constraint pk_customerprimarykeyclustered (id)

)

execsys.sp_cdc_enable_table

   @source_schema='dbo',

   @source_name ='customer',

   @role_name ='CDCRole',

   @supports_net_changes = 1

selectname,type,type_desc, is_tracked_by_cdcfromsys.tables

EXECsys.sp_cdc_add_job@job_type=N'capture';

EXECsys.sp_cdc_add_job@job_type=N'cleanup';

insert customervalues ('abc company','md')

insert customervalues ('xyz company','de')

insert customervalues ('xox company','va')

update customersetstate='pa'where id= 1

deletefrom customerwhere id= 3

declare @begin_lsnbinary(10), @end_lsn binary(10)

-- get the first LSN for customer changes

select @begin_lsn=sys.fn_cdc_get_min_lsn('dbo_customer')

-- get the last LSN for customer changes

select @end_lsn=sys.fn_cdc_get_max_lsn()

select @begin_lsn, @end_lsn

-- get net changes; group changes in the range by the pk

select*from cdc.fn_cdc_get_net_changes_dbo_customer(

 @begin_lsn, @end_lsn,'all');

-- get individual changes in the range

select*from cdc.fn_cdc_get_all_changes_dbo_customer(

 @begin_lsn, @end_lsn,'all');


Viewing all articles
Browse latest Browse all 1161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>