Transactional Replication Schema Options

  • I need to create some scripts to setup and enable transactional replication. The problem I have is that when SQL generates the code it leaves out some missing options on the table articles. The tables articles must have non-clustered indexes copied as well as converting varchar(max) to text enabled. When I run a sp_changearticle, I am able to change one property, but then when I change the other it overrides the previously set properties. I currently have something like this:

    exec sp_changearticle @publication = N'Replication1', @article = N'table1', @property = 'schema_option', @value = '0x40'

    exec sp_changearticle @publication = N'Replication1', @article = N'table1', @property = 'schema_option', @value = '0x20000000'

    If possible I would like to change all of the properties at once. Thank you for any help.

  • I found the solution to the problem. Take the two schema options you would like to change and perform a bitwise AND on the two numbers. If you take the previous example of '0x20000000' and '0x40', the new value would be '0x20000040'.

    exec sp_changearticle @publication = N'Replication1', @article = N'table1', @property = 'schema_option', @value = '0x20000040'

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

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