Sunday, March 11, 2012

change column length

Is there any tricks to change a column length in a table participating transaction replication? Is there any 'work around' without dropping & re-creating the articles?
i am aware of adding a new column (sp_repladdcolumn) and dropping an existing column (sp_repldropcolumn)
TIA
MoorthyYou can try an Alter Table statement to update the column. Test this out on a new publication before you alter the production table.||||
| You can try an Alter Table statement to update the column. Test this
out on a new
| publication before you alter the production table.
--
You can't use ALTER TABLE to change column properties on a table
participating in replication. From Books Online:
Schema Changes on Publication Databases
"Important Schema changes to a published table must be made only through
the replication publication properties dialog box in SQL Server Enterprise
Manager or through replication stored procedures. Do not make schema
changes to published tables using the SQL ALTER TABLE statements in a tool
such as SQL Query Analyzer or by using SQL Server Enterprise Manager visual
database tools. Changes made to the schema of a published table using these
tools will not be propagated to Subscribers."
A workaround to this limitation would be to:
1. add a new column, using replication stored procedures
2. update the new column with contents of old column
3. drop the old column. using replication stored procedures
Hope this helps,
--
Eric Cárdenas
SQL Server support

No comments:

Post a Comment