none
Missing Primary Key - SqlSyncDescriptionBuilder.GetDescriptionForTable - PrimaryKey column is not being returned RRS feed

  • Question

  • We are calling Microsoft.Synchronization.Data.DbSyncTableDescription description =

     

     

    SqlSyncDescriptionBuilder.GetDescriptionForTable(table, connection);

    No Primary keys are being returned, though clearly we have a primary key.  This is the only table we can detect having an issue, and there's not an obvious reason to us as to why.

    The PKColumn count is zero, and the nonPKColumnCount is equal to the number of columns in our table.  Here is the SQL from our table.

     

    CREATE

     

    TABLE [dbo].[SystemEntry](

    [SystemEntry_pk] [int]

    IDENTITY(1,1) NOT NULL,

    [Created] [datetime]

    NOT NULL,

    [Expires] [datetime]

    NULL,

    [TestKey] [varchar]

    (128) NOT NULL,

    [Inst] [varchar]

    (128) NOT NULL,

    [ConsumerProduct] [varchar]

    (128) NOT NULL,

    [ConsumerProductApplication] [varchar]

    (128) NOT NULL,

    [UserId] [varchar]

    (128) NOT NULL,

    [ApplicationKey] [varchar]

    (128) NOT NULL,

    [ContentType] [varchar]

    (128) NOT NULL,

    [Contents] [varchar]

    (max) NOT NULL,

    [Mod_DateTime] [datetime]

    NOT NULL,

    [Mod_User] [varchar]

    (50) NOT NULL,

     

    CONSTRAINT [cst_SystemEntry_pk] PRIMARY KEY NONCLUSTERED

    (

    [SystemEntry_pk]

    ASC

    )

     

    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    )

     

    ON [PRIMARY]

     

    Friday, August 27, 2010 1:12 PM

All replies

  • Please check your connection string and see if there is another table with the same name but does not contain the PK.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, September 2, 2010 5:54 PM
    Answerer
  • Which version of sync framwork/database provider did you use?

    Which version of SQL Server do you use?

    I tried to repro your scenario on SQL Server 2008 R2 + Sync Framework 2.1/3.1.  But I could get PKolumns back.

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, September 3, 2010 6:13 AM
    Answerer