How to replicate the data of table level triggers

  • Dear all,

    we are facing some problems while inserting the table level triggers in publisher.

    Procedure "Trigger_name", Line 46

    The INSERT statement conflicted with the FOREIGN KEY constraint "" The conflict occurred in database ""table "", column ''.

    The statement has been terminated.

    Kindly do the needful in how to insert the table level triggers in publisher.

    otherwise provide me the solution for enabling and disabiling the triggers while transactional replication

    With regards,

    Ram

  • This does not have anything to do with Replication. Replication does not care if there is a trigger in Publisher. The trigger might write to another table or what ever action it has to take.

    This seems like a logic problem. What other table has refrence to this table? PK FK relationship is what I mean.

    -Roy

  • Clearly FK violations on the "SUBSCRIBER" could be impacted but as already said above this has nothing to do with replication if the problem is a on the "PUBLISHER"


    * Noel

  • You can use

    exe sp_msForeachtable "ALTER TABLE ? DISABLE TRIGGER All" This disable all triggers in all tables, to disable only one table use

    alter table [dbo].[tablename] disable trigger [tiu_trigger_name]

    What I wonder is why you need to disable the trigger. It might a data related issue at the publisher. Maybe already inserted the record and when it tries to insert it again if fails?

    In any event, I agree with the assessment that is not replication problem, but data related (publisher or subscriber, check the publisher first)

    What ever you do, backup it up first

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

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