Change data capture: SQL Server’s masterstroke
Change data capture: SQL Server’s masterstroke
There will be several instances when you will be told that a particular specification in an application has a requirement that the value of data in the whole database of the said application is recorded before it gets changed. It is required solely for the purpose of saving the whole data along with the history of its changes that have been made throughout the app’s lifetime. This is a feature which is implemented solely for the purpose of data security and in order to implement this, we get to see a range of solutions such as triggers, timestamps and complicated queries also known as stored procedures while auditing data.
New features such as ‘after update’, ‘after insert’ and ‘after delete’ triggers were introduced by SQL Server 2005 and it almost seemed like the problem of tracking changes in data has been solved. However, SQL Server 2008 introduced something even better and it is known as Change Data Capture (CDC). Change Data Capture has allowed SQL Server developers to deliver data archiving and capturing in SQL Server without any additional programming, whatsoever.
It is one of the newest features of SQL Server 2008 used for data tracking and data capturing. What it does is that it only tracks the changes made to the user-created tables and since the captured data is then stored in relational tables, one can easily access and retrieve it all subsequently, simply by using T-SQL.
When SQL Server Change Data Capture features are applied to a database table, a reflecting image of the table that has been tracked is created with exactly the same column structure of the original table. However, it does have with it some additional columns which includes the metadata that has been used to summarize the nature of the change in the database table row. This all is an outstanding way to monitor the activity for the logged table in the easiest way possible and using these new audit tables one has al that is required with no losses in data whatsoever.
The SQL Server Change data capture is one revolutionary product especially for those who need to save their data time and again as they have to make changes to their applications from time to time. There is absolutely no way one can save all that data and the only option left with one is SQL Server CDC and is absolutely the best pone with no complaints at all.