Now, with Sql 2008, this made very easy. The new feature introduced on SQL 2008 “Change tracking” which enables change tracking without any coding required.
First, to enable this change tracking, we need to update the setting on DB
Once the table is enabled with tracking, you will be able to track the changes by version.
We can get all the changes by using function called CHANGETABLE. sample use of function will look like below.
SELECT * FROM CHANGETABLE
(CHANGES dbo.Employees,0) as CT
This query will provide details with SYS_CHANGE_VERSION, SYS_CHANGE_OPERATION, SYS_CHANGE_COLUMNS, SYS_CHANGE_CONTEXT, ID columns.
Take a look at this article http://www.sql-server-performance.com/articles/audit/change_tracking_2008_p1.aspx which talk about this article in detail.
No comments:
Post a Comment