Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Problem with Change Data Capture

Author  Topic 

mylogin
Starting Member

2 Posts

Posted - 2012-03-15 : 17:10:55
Hello,

In my application i want to track all the changes that the user has made, therefore i ended up using the Change Data Capture in SQLSERVER 2008 Enterprise edition.

I followed the link below and enabled the CDC for the database and one table which i would like to track.

[url]http://www.codeproject.com/Articles/166250/Microsoft-SQL-Server-2008-Change-Data-Capture-CDC[/url]

After i enabled this, i checked tracking on the table and it was enabled.

So, i went a step further and made some changes in the table like one delete, 1 insert and 2 updates.

Now, when i try to check the captured data by executing this....

DECLARE @Begin_LSN binary(10), @End_LSN binary(10)
-- get the first LSN
SELECT @Begin_LSN =sys.fn_cdc_get_min_lsn('dbo_ClientServices')
-- get the last LSN
SELECT @End_LSN =sys.fn_cdc_get_max_lsn()
-- returns net changes
SELECT * FROM cdc.fn_cdc_get_net_changes_dbo_ClientServices(
@Begin_LSN, @End_LSN,'ALL');

I am getting an error.
An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_net_changes_ ... .

I think the reason for this is the End_LSN being NULL. There is some value in Begin_LSN, but the End_LSN is null and that is reason why it is throwing the error mentioned above.

Can anyone help me with this? Why the End_LSN is returning null?

Appreciate the help
Thanks

mylogin
Starting Member

2 Posts

Posted - 2012-03-16 : 10:13:12
I got it working. The SqlServer Agent was stopped. Once i start running it, it is working fine now. I have one more question about change data capture.
I would like to keep the history log for 1 year. Is it possible?
Go to Top of Page
   

- Advertisement -