1
votes

I'm using Sync Framework with two sql server express databases. The code is working fine. I change data on server or client and it syncs with each other just fine.

What I'm trying to do is, after I setup my scope for server and client, then I import to server all the data from another database(same schema, just different server and no provision) using Sql Management Studio, but then i can't get data to sync...

Does it have to do with the way Sql Management Studio Import copies the data? Or I'm missing something? I tried using a profiler to see how the import copies the data, saw some sp being run, but couldn't figure out much.

Thanks

1
If i recall correctly, Sync framework relies heavily on the metadata stored in the SQL table. During import triggers might not work and that may cause the data not to be recognized as changes. - Dmitry Reznik
I was suspecting that, just was hoping to be wrong. thx - thiagoleite

1 Answers

0
votes

the change trackign the sync provider you're using is done via triggers. for every row you have on the base table, there is a corresponding row in the _tracking table plus rows for deleted rows in the base table.

SSMS Import Wizards uses "insert bulk" which doesnt fire triggers. so the rows are imported but the corresponding entries in the change tracking table are not.

try using bcp or bulk insert instead but make sure to enable firing of triggers.

see: Controlling Trigger Execution When Bulk Importing Data