patternsqlMinor
SQL Server Replication: "ALTER TABLE ALTER COLUMN" is not propagated to subscribers
Viewed 0 times
columnsqlpropagatedsubscribersreplicationserveraltertablenot
Problem
We are running SQL Server 2008 R2 SP1 as publisher & distributor, and SQL Server 2005 SP3 as subscriber. The replication of schema changes is activated, and the replication has been running for years, including frequent schema changes (new column, new constraints, etc).
The following instruction was sent on the publisher:
where field
The query ran without errors on the main database. The result is the following:
Any idea on what is going on with this database?
Publisher: object browser window vs property window give incoherent data
The following instruction was sent on the publisher:
use myDatabase
alter table Tbl_TypeLignePaye
alter column natureTypeLignePaye nvarchar(12)
gowhere field
natureTypeLignePaye was originally nvarchar(3) nullThe query ran without errors on the main database. The result is the following:
- The field natureTypeLignePaye still appears as
nvarchar(3)in the object browser
- The column properties screen indicates a
nvarchartype with a length of12
- The change was not propagated to the subscribers
Any idea on what is going on with this database?
Publisher: object browser window vs property window give incoherent data
Solution
If anyone wants to increase the column width of the replicated table in SQL Server 2008, then no need to change the property of
-
run command
Hope this will help all who are looking for it.
replicate_ddl=1. Simply follow the steps as given.- Open SSMS
- Connect to Publisher database
-
run command
ALTER TABLE [Table_Name] ALTER COLUMN [Column_Name] varchar(22)- It will increase the column width from varchar(x) to varchar(22) and same change you can see on subscriber (transaction got replicated). So no need to re-initialize the replication
Hope this will help all who are looking for it.
Code Snippets
ALTER TABLE [Table_Name] ALTER COLUMN [Column_Name] varchar(22)Context
StackExchange Database Administrators Q#40660, answer score: 4
Revisions (0)
No revisions yet.