Monday, February 20, 2012

removing and adding objects from publication

I am replicating all tables and views in a database with snapshot
replication. It is giving an error because View2 is dependent on View1 but it
is trying to create View2 first. I was going to delete and recreate View2 so
it would come after View1 but when I went to delete View2 I got an error
saying that I couldn't delete the view because it is being used by
replication. Is there any way I can delete and recreate View2 without having
to delete all of my replication setup? Is there an easy way to remove and add
objects to a publication? Thanks!
Thanks Paul - I see that this will help me delete the view. When it is
recreated how can I add it back into the publication? Thanks!
"Paul Ibison" wrote:

> You should be able to use this type of approach:
> exec sp_dropsubscription @.publication
> = 'PDS_to_Cab_Tables'
> , @.article = 'SNAPSHOT_RELEASE_INFO'
> , @.subscriber = 'RSCOMPUTERXXX'
> , @.destination_db = 'delivery'
>
> for each subscriber, then...
> exec sp_droparticle @.publication = 'PDS_to_Cab_Tables'
> , @.article = 'SNAPSHOT_RELEASE_INFO'
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||sp_addarticle and sp_addsubscription will do it.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

No comments:

Post a Comment