Replication Problem

  • Good people am getting this error and i cant figure out why this is happening

    if anyone has ever encountered this please come to my aid as this is making a subscriber unable to synch data

    Error messages:

    The schema script 'if object_id(N'[domain].[uncircumcised_respondent]') is not null exec('ALTER TABLE [domain].[uncircumcised_respondent] ADD CONSTRAINT

    fk_uncircumcised_respondent_participating_respondent FOREIGN KEY

    (

    participating_respondent_id

    ) REFERENCES domain.participating_respondent

    (

    id

    ) ON UPDATE CASCADE

    ON DELETE CASCADE

    NOT FOR REPLICATION

    ')' could not be propagated to the subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)

    Get help: http://help/MSSQL_REPL-2147201001

    There is already an object named 'fk_uncircumcised_respondent_participating_respondent' in the database. (Source: MSSQLServer, Error number: 2714)

    Get help: http://help/2714

    Could not create constraint. See previous errors. (Source: MSSQLServer, Error number: 1750)

    Get help: http://help/1750

  • Hi

    You didn't specify what kind of replication you have (or other details),

    but from the error is it obvious that it's trying to create a fk constraint on the subscriber side where that fk already exists.

    You could try to resolve it by:

    -deleting that fk directly on subscriber side

    There is an option of reinitializing replication but I would do my best to avoid it.

    Is that transactional replication?

    Maybe you could revise replication options later?

    Is subscriber updated in any other way except through replication?

    If not, foreign keys might not be needed because control is done on publisher side.

    Please let me know how is this going.

  • Based on this error you are either applying a snapshot or replicating a ddl change.

    Basically the foreign key already exists at the subscriber and for some reason the if object_id query is failing to drop it. The easiest way to fix it is to drop it manually at the subscriber(s)

    IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[domain].[fk_uncircumcised_respondent_participating_respondent]') AND parent_object_id = OBJECT_ID(N'[domain].[uncircumcised_respondent] '))

    ALTER TABLE [domain].[uncircumcised_respondent] DROP CONSTRAINT [fk_uncircumcised_respondent_participating_respondent]

    GO

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply