Does anyone know how to dynamically set the -SubscriberDB name for the distributor agent job in snapshot replication?

I have a scenario where I want to switch this between two databases, depending on which one the customer is using. Essentially the unused one is inactive, and the one I want the snapshot to be applied to.

This is the command in the Replication Distributor job, I am trying to dynamically set the -SubscriberDB name.

-Publisher [server_name] -PublisherDB [publisher_database_name] -Publication [publication_name] -Distributor [distributor_name] -SubscriptionType 1 -Subscriber [subscriber_server] -SubscriberSecurityMode 1 -SubscriberDB [subscriber_database_name]

Thanks.

  • Have you tried to declare a variable, assign the value based on your condition (may be if-else condition)? Pass the variable as the -SubscriberDB parameter value. – SqlWorldWide Oct 18 at 1:04

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.