Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

How can I tell if Trigger code is being executed at a Replication Subscriber?

$
0
0

I have a SQL Server 2012 database that is being Published for replication and a pull Subscription defined on another server. I have a Trigger that I need executed at the Subscriber end, however the source database is supported by a third party so to decrease the chance of them unwittingly blowing away my Trigger by doing table maintenance I defined the Trigger on the Publisher and set the Article option for Copy User Triggers to True.

That works okay, but what I don't want is for the Trigger to execute at the Publisher. (This is a reverse situation to using the NOT FOR REPLICATION option.) I've currently achieved this by wrapping the Trigger logic in a hard-coded test on @@SERVERNAME but we upgrade servers company-wide every 5 years or so and it is always a pain having things break that are hard-coded to the old names.

Is there a system view or something I can test against instead that will say "This database got here via a pull subscription"?

Thanks

Wayne Ivory


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>