MS Sync Framework 2.1 - How to handle a table structure change? RRS feed

  • Question

  • Hi,

    I have been using the MS Sync Framework 2.1 successfully for some months now to synchronize SQL Server databases.  The table structure of one of the tables has changed (a new field been added).  How do I get this to synchronize?  The only success I have had is to deprovision the server database and the client database and then reprovision them.

    I tried manually adjusting the BulkType definition and the Stored procedures in the databases, but it didn't work.

    Can this be done without going through the whole deprovision/provision process?

    Thanks for any help,


    • Edited by FCazabon Thursday, December 12, 2013 1:32 PM
    Thursday, December 12, 2013 1:32 PM

All replies

  • Thanks, that looks helpful


    Friday, December 13, 2013 11:51 AM
  • I've looked more closely at the work around suggested for adding columns to a table.  Someone had actually given me the code referred to in part 3 for adding a column already, but it wasn't working for me.

    What is happening is that the alterScopeSql still contains the code to create all the stored procedures for all the other tables, not just the one I have adjusted.  Should it be like that or should the script only have the code to create the stored procs and bulktype for the affected table?

    I was wondering if the difference was that I am using SQL 2012, not SQL 2008.  Maybe the provisioningScript has changed between versions?


    Friday, December 13, 2013 2:31 PM
  • there is no specific code for sql 2008 or 2012. they all use the same sync provider.

    if you know which table has change, you can always skip all the other tables.

    you get all the statements for the other tables because the code uses the Sync Fx generate script functionality to generate the objects given a scope definition.

    Monday, December 16, 2013 1:52 AM
  • Thanks, what I am seeing happening is if I have two tables in the database and I add a column to 1, then just prior to this line:

    string[] commands = alterScopeSql.Split(new string[] { "GO\r\n","GO ""GO\t""GO" }, StringSplitOptions.RemoveEmptyEntries);

    The alterScopeSql has the scripts for the table that I am trying to adjust in twice.  Once without the new column and once with.  It also has the other unchanged table still in there.  So when executing the script I get errors that the unchanged table's procs already exist and that the changed table is in there twice.  Maybe I am not understanding what is supposed to be done.  Am I supposed to drop all the other table's Stored Procedures and Bulk types as well as the one that has been changed?

    If I manually adjust the stored procedures, etc I get it to work, but I just can't get this code going.  I would appreciate any help you can give to point me in the right direction.


    Monday, December 16, 2013 12:59 PM
  • You might want to read the post again...
    Monday, December 16, 2013 2:18 PM
  • LOL, thanks.  Does that mean that you think I am misunderstanding the post?  I have been through it about 5 times now looking to see if I have made a mistake but am not seeing anything.  I know at times it is difficult to see errors when working on something for too long so that is completely possible.


    Wednesday, December 18, 2013 1:43 PM