Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Track changes of a table vaules in Sql 2008

By shivam.shah,

This script will show the changes made to the rows of the table.

First enable change tracking for database and then for the table. This can be done in properties window.

 

@lastSyncNumber is the last commited sync number for the changes made.

 

CHANGE_TRACKING_IS_COLUMN_IN_MASK(COLUMNPROPERTY(OBJECT_ID('employee'), 'Active', 'ColumnId'), SYS_CHANGE_COLUMNS)IsActiveChanged

This statement will show if this particular column for the row has changed or not. If it returns 1 means change and 0 means not change,

 

Total article views: 2049 | Views in the last 30 days: 10
 
Related Articles
FORUM

Column value changed?

When did the Column Schema changed Date Time?

FORUM

SQL-Server 2005: Change Ordinal Column Position

SQL-Server 2005: Change Ordinal Column Position

SCRIPT

Change the collation of Columns

This script changes the collation of columns to default database collation in all the tables

FORUM

Changing datatype problem in derived column in SSIS 2008

Changing datatype problem in derived column in SSIS 2008

BLOG

CDC changes column-by-column instead of row-by-row, can you improve it???

CDC changes column-by-column instead of row-by-row, can you improve it???.

Tags
auditing    
 
Contribute