none
Azure Sync Agent not detecting table with composite key in database schema RRS feed

  • Question

  • I have a database, [Database1], on server server1.database.windows.net that is being used as a hub for a sync group. The sync group is syncing to database's hosted on the following servers with the exact same schema as the hub database: server2.database.windows.net server3.database.windows.net When I go to the Sync Rules of the Sync Group, I can see the majority of tables in the schema. However, one table, which has a composite key, does not appear in the schema as detected by the Sync Group. This table is [dbo].[MerchantSites] and is defined as below. It is critical to us that this table us synced across all databases, however I cannot determine how we can add this to the sync server. Does anyone know of any restrictions with regards to composite keys and Azure Sync? Does anyone know of a work around for this?

    To confirm - all inserts on the hub database including those to the table with the composite key work correctly. All other tables from the schema are being synced correctly to the databases on server2 and server3.

    Thanks for any help you can provide.


    USE [Database1] GO /****** Object: Table [dbo].[MerchantSites] Script Date: 09/09/2013 13:09:14 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[MerchantSites]( [MerchantId] [uniqueidentifier] NOT NULL, [MerchantSiteId] [uniqueidentifier] NOT NULL ) GO ALTER TABLE [dbo].[MerchantSites] WITH CHECK ADD CONSTRAINT [FKC6BB5CDC7FC6D14E] FOREIGN KEY([MerchantSiteId]) REFERENCES [dbo].[MerchantSiteBase] ([Id]) GO ALTER TABLE [dbo].[MerchantSites] CHECK CONSTRAINT [FKC6BB5CDC7FC6D14E] GO ALTER TABLE [dbo].[MerchantSites] WITH CHECK ADD CONSTRAINT [FKC6BB5CDCDA5C5AAD] FOREIGN KEY([MerchantId]) REFERENCES [dbo].[Merchant] ([Id]) GO ALTER TABLE [dbo].[MerchantSites] CHECK CONSTRAINT [FKC6BB5CDCDA5C5AAD] GO

    Monday, September 9, 2013 3:39 PM

Answers

All replies

  • most likely because it cant find a PK
    • Marked as answer by ChrisKennedy Tuesday, September 10, 2013 2:55 PM
    Tuesday, September 10, 2013 1:40 AM
    Answerer
  • Hi JuneT,

    Thanks that solved my problem, I created PK from the composite key and the table is now visible, appreciate this, the solution wasn't apparent based on what I had read.

    Cheres

    Tuesday, September 10, 2013 2:55 PM
  • its actually in the docs, every table that needs to participate in Sync needs a PK. without it, the service have no idea how to identify each row and thus not able to update or delete a row.
    • Edited by JuneTEditor Tuesday, September 10, 2013 11:34 PM
    Tuesday, September 10, 2013 11:33 PM
    Answerer