Randy Minder
Randy Minder

Reputation: 48502

Transaction Replication and Triggers

Say ServerA.TableA is replicated (via Transactional Replication) to ServerB.TableA. If a trigger existed on ServerB.TableA that fired when a row was inserted or updated, would the trigger fire as rows are replicated from ServerA.TableA?

Upvotes: 2

Views: 748

Answers (2)

Remus Rusanu
Remus Rusanu

Reputation: 294407

It depends on how the trigger was created. CREATE/ALTER TRIGGER statements support the NOT FOR REPLICATION clause:

NOT FOR REPLICATION Indicates that the trigger should not be executed when a replication agent modifies the table that is involved in the trigger. See Controlling Constraints, Identities, and Triggers with NOT FOR REPLICATION.

Upvotes: 4

Sam
Sam

Reputation: 7678

would the trigger fire as rows are replicated from ServerA.TableA?

Aren't the transactions shipped and applied to the remote server - not rows? This would lead me to think that the transactions are simply applied and the trigger is not actually fired, but the results are applied.

I'm no expert on this - just an idea.

Upvotes: 0

Related Questions