all groups > sql server replication > january 2006 >
You're in the

sql server replication

group:

Schema changes to subscriber


Schema changes to subscriber David
1/20/2006 2:51:14 PM
sql server replication:
How do schema changes actually get to the subscriber? I need to do an ALTER
TABLE to add columns to a table on the Publisher and have the subscribers
pick up the change AFTER they synch/upload their data changes. We are doing
Merge replication to anonymous laptop subscribers. I am hoping the
subscriber uploads will run first as the ALTERed table may have data in the
new column.
Also, I think I need to sp_dropmergearticle before the ALTER TABLE command
and then sp_addmergearticle after the ALTER.

Thanks.
David

Re: Schema changes to subscriber Paul Ibison
1/20/2006 9:10:15 PM
David,
to add a column, it's a matter of using sp_repladdcolumn. To change an
existing one is slightly different. The alter table syntax you suggest is
supported in sql server 2005 only.
please check out these articles:
http://www.replicationanswers.com/AddColumn.asp
and
http://www.replicationanswers.com/AlterSchema2005.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Re: Schema changes to subscriber David Chase
1/22/2006 11:31:50 AM
Thank you Paul. Just to clarify, if I have more than 1 table to add columns
to or to create, how should the @force_invalidate_snapshot be handled on
each sp_repladdcolumn? My configuration is one Publisher and several
anonymous subscribers as laptops. I want to make sure that each laptop gets
their updates to the Publisher before getting a new snapshot (assuming a new
snapshot is needed).

Also, can I just use CREATE TABLE for any new tables that will not be part
of the replication? Thanks.

David

[quoted text, click to view]

Re: Schema changes to subscriber Paul Ibison
1/23/2006 9:02:32 AM
David,
this depends on whether you keep a snapshot ready for any new subscribers.
In my case I always have named subscribers and run the snapshot agent
manually, so the bit would always be set to 0 (actually in my case it
doesn't matter what the setting is).
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

AddThis Social Bookmark Button