sp_repladdcolumn (Transact-SQL)
Adds a column to an existing table article that has been published. Allows the new column to be added to all publishers that publish this table, or just add the column to a specific publication that publishes the table. This stored procedure is executed at the Publisher on the publication database.
Important
|
|---|
|
This stored procedure has been deprecated and is being supported mainly for backward-compatibility. It should only be used with Microsoft SQL Server 2000 Publishers and SQL Server 2000 republishing Subscribers. This procedure should not be used on columns with data types that were introduced in SQL Server 2005 or SQL Server 2008. |
sp_repladdcolumn [ @source_object = ] 'source_object', [ @column = ] 'column' ]
[ , [ @typetext = ] 'typetext' ]
[ , [ @publication_to_add = ] 'publication_to_add' ]
[ , [ @from_agent = ] from_agent ]
[ , [ @schema_change_script = ] 'schema_change_script' ]
[ , [ @force_invalidate_snapshot = ] force_invalidate_snapshot ]
[ , [ @force_reinit_subscription = ] force_reinit_subscription ]
sp_repladdcolumn has been deprecated and is supplied for backward-compatibility only. Adding a column to a replicated table article should be done by executing data definition language (DDL) commands against the published table. Replication automatically replicates these DDL commands as long as DDL replication has been enabled. For more information, see Make Schema Changes on Publication Databases.
sp_repladdcolumn is still required when propagating DDL changes from republishing Subscribers running on an earlier version of SQL Server 2000 Subscribers.
sp_repladdcolumn is used for all types of replication.
When using sp_repladdcolumn, if a schema change is made to an article that belongs to a publication that uses a Data Transformation Services (DTS) package, the schema change is not propagated to the Subscriber, and the custom procedures for INSERT/UPDATE/DELETE are not regenerated on the Subscribers. The user needs to regenerate the DTS package manually, and make the corresponding schema change at the Subscribers. If the schema update is not applied, the Distribution Agent may fail to apply subsequent modifications. Before making a schema change, make sure there are no pending transactions to be delivered.
When typetext is assigned a default value that is a nondeterministic function (for example, 'datetime not null default getdate()'), non-convergence can occur after adding the new column because the function is executed at the subscriber in order to load a default value into the column.
Timestamp and computed columns are filtered out for character mode publications. If adding a timestamp or computed column using sp_repladdcolumn, subscriptions of such publications do not receive this new column.
Important
|
|---|
|
A backup of the publication database should be performed after sp_repladdcolumn has been executed. Failure to do so can cause a merge failure after a restore of the publication database. |
Important