Do INSERT triggers fire during MERGE replication?

  • Probably a dumb question. But we are experimenting with MERGE replication.

    If I insert a record into table A, I have an AFTER INSERT trigger which executes a procedure to update another table B.

    My other job site is a subscriber to both table A and table B, and when someone there inserts a record into table A, the AFTER INSERT trigger executes a procedure to update their table B.

    Every evening, we intend to use Merge Replication to combine the day's work and synchronize the data. Replication makes sure I have the changes made by the other job site, and they have the changes made at the home office.

    But do AFTER INSERT triggers fire when the Replication inserts new records into the table? Or is this not really considered an INSERT into the table?

  • Triggers will fire - I have needed that to happen before. I think there may be a setting on the article to disable them though.

  • you can see what happens during replication via SQL profiler.

    -----------------------------
    www.cbtr.net
    .: SQL Backup Admin Tool[/url] :.

  • Well, I think I answered my own question. It apparently is true that triggers will execute. If I do not want them to execute (which is the case in my application), I need to alter the trigger to include a

    NOT FOR REPLICATION

    in the statement. Viz.

    http://technet.microsoft.com/en-us/library/ms189799.aspx

    Thanks to those who replied.

  • if you have independent regions (eg NYC, London, Tokyo) it is commonplace to have IDENTITY blocks so these don't overlap/conflict. But often you will want the NFR functionality you've already found.

    HTH

    Dick

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

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