4

I'm using sql server change tracking and I noticed some unexpected behavior that doesn't seem to be documented.
The documentation indicates that the value returned by CHANGE_TRACKING_MIN_VALID_VERSION ( table_object_id ) should be compared against the last sync version before using the changes returned by the ChangeTable. This makes sense so I coded my sync process to make this check and then stored the values return by calling CHANGE_TRACKING_CURRENT_VERSION. Here is the documentation I referenced.

The next time I ran the sync process it compared the two values and again the min valid version was greater than the last sync version. After troubleshooting I realized that the current version returned by CHANGE_TRACKING_CURRENT_VERSION was actually less than the min valid version.

Is this expected behavior? I can certainly work around it by storing the min valid version if it's greater than the current version. I did notice that the current version was incremented as soon as a change was made to a table that had change tracking enabled. This could be only an issue in a dev environment since the database I'm using is seldom changing. I just want to make sure I'm not missing something.

BenR
  • 11,296
  • 3
  • 28
  • 47
  • To answer the title, [yes](http://technet.microsoft.com/en-us/library/cc280447(v=sql.105).aspx). I'm not that familiar to answer any more, but I've seen this happen once before in an app that did it. – Bacon Bits Dec 03 '14 at 16:02
  • @BaconBits Thanks for the link, that's good info. In this case I know that the database wasn't restored. – BenR Dec 03 '14 at 16:12
  • Did you ever find a resolution to this as I have the same problem and even M$ technical support do not seem to be able to resolve it. – Martin Robins May 02 '18 at 10:29
  • @MartinRobins I have not found a resolution for this. It doesn't happen often but it is problematic. – BenR May 02 '18 at 18:53

0 Answers0