0

I am using SQL Server 2008 and have transactional replication setup. I need to be able to execute a pre replication script on the publisher and then a post replication script on the subscriber. Is this possible with transactional replication?

I have found this other article on here, but the post script here only gets executed when the snapsnot is delivered to the subscriber.

Community
  • 1
  • 1
TechyGypo
  • 824
  • 1
  • 11
  • 27

1 Answers1

1

This will work if you are running the Distribution Agent on a schedule. Edit the Distribution Agent SQL Agent job. Add a step prior to the Run Agent job step to execute a SQL script on the Publisher. Then add a step after the Run Agent job step which executes sp_addscriptexec to post a SQL script to the Subscriber.

I have a post describing sp_addscriptexec in Executing scripts with sp_addscriptexec. I recommend trying this in your test environment prior to deploying to production.

Brandon Williams
  • 3,695
  • 16
  • 19