Posts

Showing posts from January, 2019

Adding a new table to Replication in MSSQL Server without reinitializing the Snapshot

Image
There are some prerequisites for Tables to be a part of replication: It should have a PRIMARY KEY It should have IDENTITY NOT FOR REPLICATION NOT NULL: If prerequisites are not met for Primary key you will see the following error: Msg 14088, Level 16, State 1, Procedure sp_MSrepl_addarticle, Line 1539 [Batch Start Line 0] The table '[dbo].[T_YourTableNameHere]' must have a primary key to be published using the transaction-based method. Though NOT FOR REPLICATION FOR IDENTITY will not throw any error during the time you are adding the table to replication but it will start throwing errors once you will start inserting rows or data into the table and I am guessing you must have heard this earlier "prevention is better than cure" . Alright once prerequisites has been taken care of  this tasks can be accomplished using the following steps : Create table in Publisher Node. Create table in all Subscriber Nodes. Use sp_addarticle to add and publish the new