Merge Replication - Best Way to Add Nonreplicated Columns

  • Publisher and all subscribers are 2008. I need to add several columns to both publisher and subscriber published tables, but I don't want these new columns to be replicated (they are audit columns and I need to know the values as they relate to the instance they are on).

    I can add the columns and let replication propagate them, then remove them after with sp_mergearticlecolumn, but that requires a re-init, which is what I need to avoid. My plan is to drop the subscriptions, then add the columns, and vertically partition those tables so those columns aren't in the new subscriptions. We are 7\24 business and my only window is to do this on Easter, when it's guaranteed noone is working. Not a problem but I'd rather not spend Easter doing this if there's a better way.

    Just curious if anyone's done anything like this, and how? Thanks in advance.

  • EXEC sp_changepublication @publication = 'publication'

    , @property = 'replicate_ddl'

    , @value = '0'

    /* ALTER TABLES NOW */

    EXEC sp_changepublication @publication = 'publication'

    , @property = 'replicate_ddl'

    , @value = '1'

    Or you can add the column as suggested and use sp_mergearticlecolumn to unpublish it (vertically filter the article)

    We dont replicate DDL for this reason so we continue to use sp_repladdcolumn to publish changes.

  • Thank you.

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

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