Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 1982 | Views in the last 30 days: 15
 
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

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones