locked
Cannot use a DbSyncTableDescription with no primary key columns defined for synchronization provisioning RRS feed

  • Question

  • when i tried to synchronize my SQL 2008 R2 Db with  SQL 2005 DB with the help of Sync Famework 2.1, it showing this exception

    "Cannot use a DbSyncTableDescription with no primary key columns defined for synchronization provisioning"...

    is it neccessery that primary key columns defined for sync..?

     

    Thursday, February 3, 2011 12:15 PM

Answers

  • Yes it is necesary to have primary key columns defined in all the tables that you want to synch, these are needed for the DbSyncProvider to track changes.  Tables with no primary key columns will not be synchronized.

     


    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Thursday, February 3, 2011 6:36 PM

All replies

  • Yes it is necesary to have primary key columns defined in all the tables that you want to synch, these are needed for the DbSyncProvider to track changes.  Tables with no primary key columns will not be synchronized.

     


    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Thursday, February 3, 2011 6:36 PM
  • thanks for your reply..that helped
    Friday, February 4, 2011 5:07 AM
  • In this case if i want to sync all the tables, some may not have primary key..

    how can achieve this?

    Please help me.

    Tuesday, February 7, 2012 6:47 AM
  • so how do you differentiate one row from the other? why can't they have a primary key?
    Tuesday, February 7, 2012 7:18 AM
  • Hi Sagar,

    did you solve this issue? I'm stuck with the same problem right now...

    Thursday, June 28, 2012 1:47 PM
  • if you have a column in the table that can uniquely identify a row similar to a PK but dont have a real PK defined in the table, you can "trick" Sync Framework to use that column as PK.

     // “trick” Sync Fx that a column is the PK

  • serverScopeDesc.Tables["YourTable"].Columns["SomeUniqueColumn"].IsPrimaryKey = true;

    see: Part 3 – Synchronizing tables where Client and Server Primary Keys are different

Friday, June 29, 2012 1:31 AM