Adding a column with a foreign key constraint to replicated table

  • Hi,

    Been a while since I did any proper giggery pockery with a replicated table.

    Scenario is, existing table is already included in a publication, a new column is to be added to the table and this new column is to be replicated. I would generally do the following

    exec sp_repladdcolumn

    @source_object = [Object name]

    , @column = [Column name],

    , @typetext = 'int not null default 1'

    , @publication_to_add = [Publication name]

    run a snap shot and "Robert's your fathers brother"

    The only potential fly in the ointment is that the new column has a foreign key constraint to another table, that is not (currently) being replicated. How do I add this FK??

    Any and all assistance gratefully received.

  • Usually on the replicated table on the subscriber, you dont enforce constraints. But the answer depends on whether it is a Peer to peer or Non Updatable Transactional replication or Merge.

    -Roy

  • Many thanks

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

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