Groups | Blog | Home
all groups > sql server replication > march 2006 >

sql server replication : can you prevent a trigger from replicating to subscriber



Jake
3/13/2006 9:16:22 PM
Hello,

We have a trigger on a publisher that needs to update a different
database on the server instance. The problem is that the trigger is being
replicated to the subscribers who then error out as they do not have the
other database on the client instance. Is there a way to not replicate the
individual trigger? We need the table on both the server as well as the
client. We just would like the trigger to fire off on the server.

If this is not possible is there a way to catch the error:
Msg 208, Level 16, State 1, Procedure trg_test_jake, Line 31
and still allow the insert/update to continue? Thanks in advance.

Jake

Paul Ibison
3/14/2006 12:00:00 AM
Jake,
the value of @schema_option on sp_addarticle will determine if user triggers
are replicated. This can't specify individual triggers though. To replicate
some but not all triggers, I'd use a post-snapshot script.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Hilary Cotter
3/14/2006 9:54:21 AM
Script the triggers out on the subscriber and add the Not For Replication
attribute to them.

If the only DML on the subscriber is from replication, these triggers will
never fire.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

AddThis Social Bookmark Button