Adding new article to a publication

  • Hello everybody

    I'm new on Replication in Sql Server...

    I haver transactional replication working, and I have to add a table.

    I wonder how can I add a table to a publication that exists and this change don't affect to the data already replicated. I mean, I don't want to replicate all the data in the publication. I only want to add a table..

    Is anyway to do it without delete the data already replicate?

    Thanks in advance

  • Right click on the publication you have created, select Properties, click Articles,

    clear the check box "Show only selected objects in the list"

    then select the table that you want to add to the replication...

    After adding the new article to the publication, reinitialize the subscription. Snapshot of the newly added article will be created. Existing articles will not be affected.

  • I have never been able to add an article with the GUI when there is an active subscription. I will test Suresh's post.

    You can do in script:

    exec sp_addarticle @publication = N'PubNameHere', @article = N'TableName', @source_owner = N'dbo'

    , @source_object = N'TableName', @destination_table = N'TableName', @type = N'logbased', @creation_script = null

    , @description = null, @pre_creation_cmd = N'drop', @schema_option = 0x00000000000000F3, @status = 16

    , @vertical_partition = N'false', @ins_cmd = N'CALL sp_MSins_TableName', @del_cmd = N'CALL sp_MSdel_TableName', @upd_cmd = N'MCALL sp_MSupd_TableName', @filter = null

    , @sync_object = null, @auto_identity_range = N'false'

    GO

    sp_addsubscription @publication = 'PubNameHere'

    , @article = 'TableName'

    , @subscriber = 'SubscrServerName'

    , @destination_db = 'DBName'

    , @sync_type = 'automatic'

    GO

    Then run snapshot - only new table will be pushed.

    ChrisB MCDBA

    MSSQLConsulting.com

    Chris Becker bcsdata.net

  • I would always do this via the scripts.

    Just a reminder, Suresh said reinitialize the subscription...you don't want to do that as that will require a new total snapshot.

    If you add an article through the GUI you will just need to run the snapshot and then distribute....please correct me if I'm wrong.

    G

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

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