Question

Presently, I'm tracking changes to all of my tables using SQL Server 2008 Change Tracking. Everything works out of the box just fine. However, an additional complexity is that the application reading these changes needs to make a change to a date column on each table that is being tracked. Changes in my application are like triggers to tell me that I need to send out additional data. This could cause an endless cycle if not managed.

There's a sent date that gets filled in after each change is read.

Is it configurable at a database/table level to ignore an individual column on a table so that versions/changes are not tracked when that column is modified?

Was it helpful?

Solution

Using change tracking, there's two ways but both involve merely filtering the results; there is not a way to limit the change tracking by column.

1) Filter by context

The following link shows how to change the context for when an application changes data. If you change the context specific to what is making the changes, you can then filter it by that when you query. http://msdn.microsoft.com/en-us/library/cc280462(v=sql.105).aspx

2) Filter using the columns updated mask

In addition, I have to admit that I roll my own change tracking still. I have scripts that I execute to autogenerate code triggers. They can be customized to prevent non-changing updates (i.e. a row update that changes no fields you are interested in), plus they allow me to fully control things. I can track which fields I want, plus I can move all of my tracking/default fields (such as suser_sname()) into the tracking table so that the day to day business tables are kept slim. If you are interested in this option, reply as such and I'll post the code to autogenerate the triggers and tracking table for a given table name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top