Getting "Subscriber" when replicating to other environments

  • OK...I am almost there!! What I need to do is build a little query (??) at the top of my script, that will get me the name of the Subscriber (Servername) on whatever environment I will be running the deployment scripts on.

    I want to use a variable in the replication exec calls, @Servername, (see as follows):

    PRINT N'Dropping tables from subscription'

    GO

    exec sp_dropsubscription @publication = 'Org_ETL'

    , @article = 'PersonOrg'

    , @subscriber = @ServerName

    , @destination_db = 'Org'

    GO

    ....and also when I am adding the articles back in, use this same @Servername where Subscriber = @ServerName.....

    Can you give me some tips?? I am not replication table savvy yet!!!

    Thank you AGAIN!!!!! :hehe:


    Thank you!!,

    Angelindiego

  • DECLARE @SubscriberName varchar(100)

    SET @SubscriberName = @@Servername

    Select @SubscriberName

    Would this work? But that would mean that you have to run the subscriber scripts on each of the Subscriber Database server.

    -Roy

  • We will check it out for sure!! Thanks Roy!!


    Thank you!!,

    Angelindiego

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply