Wednesday, 15 July 2009

Adding, Dropping Column in SQL Server Replication Table

Objective: To modify the existing table structure in the replicated table

ALTER TABLE [dbo].[T_TableName] drop CONSTRAINT [Constraintname] DEFAULT ((0)) FOR [ColumnName]
GO
Exec sp_repldropcolumn @source_object = 'T_TableName'
, @column = 'ColumnName'
GO
Exec sp_repladdcolumn @source_object = 'T_TableName'
, @column = 'ColumnName'
, @typetext = 'Bit Not Null CONSTRAINT constraintName DEFAULT (0)'
, @publication_to_add = 'All' -- This indicates whichever publication holds this table, will modify.

No comments:

Post a Comment