views:

10

answers:

0

I have a table that has a version timestamp column. No creation date. Running the visual studio wizard with the localdatacache. It creates 2 triggers one for insert and one for delete. It also create an additional column CreationDate => DEFAULT VALUES TO @@DBTS + 1.

First confusion : It has created and additional column with a default value. BUT in the trigger for insert, it also set the CreationDate to @@DBTS + 1 .... ??? Why is there a trigger for the insert .... it seems like the default value for the CreationDate column should suffice ...

Second confusion .. or bug ? : Whenever I delete a record it also set the DeletionDate = @@DBTS + 1. So let's say that currently the @@DBTS is 2014. Now when I delete a row it will set the DeletionDate to 2015. And the @@DBTS still is 2014. In the generated SelectIncrementalDeleteChanges it will do a select based on this where statement (which has been generated by visual studio wizard)

"SELECT [Id], [DeletionDate] FROM dbo.Table_2_Tombstone WHERE (@sync_initialized = 1 AND [DeletionDate] > @sync_last_received_anchor AND [DeletionDate] <= @sync_new_received_anchor)"

The @sync_new_received_anchor = @@DBTS (which is also generated from visual studio) (I'm aware its better to use min_active_rowversion)

So in our example @sync_new_received_anchor = 2014.

So the issue I'm getting is that the deleted record is not being downloaded on the client side ...

Has anyone worked with MS Sync encountering the same confusions?