locked
Synchronize with views instead of tables RRS feed

  • Question

  • How can I synchronize SQL server views instead of TABLES with sql server compact database?
    Friday, May 14, 2010 11:33 AM

Answers

  • After you include a ROWGUIDCOL type of column in the view, the sync framework will use this column as PK. Internally, Sync Service uses either the PK columns or ROWGUIDCOL column as the PK. Again, we didn't test with view, and I hope it may work.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, May 17, 2010 8:05 PM

All replies

  • afaik, using views is not a supported scenario.

    however, you can still make it work depending on your sync requirements? are you going to use the views as a source?

    Friday, May 14, 2010 12:36 PM
  • Fisrt of all thank you for your reply...Well I already implement that solution but I have a probem.

    I can synchronize seperately download only, upload only, snapshot . But the problem starts when for the first time after a succesfull synchronization download only change my mobile app dynamicaly to synchronize that specific table with snapshot and I got the following message { Table 'U_ASSORTS' does not have a primary key.Add a primary key or specift that a ROWGUIDCOL column should be used uniquely identity rows in the table ...............}

    According to my implementation now the U_ASSORTS is not a table but a  VIEW  so there is a workaround to that approaching....?

    thank you in advanced

    Friday, May 14, 2010 12:47 PM
  • am assuming your using SqlSyncAdapterBuilder. If you are, you can set the RowGuidColumn property.
    Friday, May 14, 2010 12:56 PM
  • I ve done the whole thing with the studio wizard  I do not used any custom adapter yet in my implementation

    the studio created for each table a single adapter for example

    U_ASSORTSSyncAdapter  can I set the rowguidcolumn inside to those adapters?

     

     

    Friday, May 14, 2010 1:04 PM
  • Hi,

    If you can include a ROWGUIDCOL column in your view, it might work. If your data tables do not have a ROWGUIDCOL, you need to add one in order to expose it from your view. Again, it is an unsupported scenarios as JuneT mentioned, and you may hit other issues later. The Sync Service change tracking is against the data table not the view.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Friday, May 14, 2010 6:14 PM
  • Hi I understand that approaching but the problem is how to add a column to the VIEW which has property of ROWGUIDCOL is that possible
    Monday, May 17, 2010 7:49 AM
  • as mentioned by Dong, if the underlying table has no ROWGUIDCOL, you have to add one and add that column in the view.
    Monday, May 17, 2010 10:13 AM
  • I understad it but the problem is to put tha column as rowguidcolumn. So If we guess I put that column to the view which will be its data type and how the synchronization process understand it ?
    Monday, May 17, 2010 10:28 AM
  • After you include a ROWGUIDCOL type of column in the view, the sync framework will use this column as PK. Internally, Sync Service uses either the PK columns or ROWGUIDCOL column as the PK. Again, we didn't test with view, and I hope it may work.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, May 17, 2010 8:05 PM