Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Change constraint whilst under replication

Author  Topic 

chaos
Starting Member

2 Posts

Posted - 2007-05-01 : 01:25:06
Hi =)

I hope someone out there has the know-how to do this.

We have 1 publisher with a couple dozen subscribing machines. All machines are running MS SQL 2000. No subscriber carries the same check constraint for any of the tables.

An error is thrown when you attempt to remove a constraint when the table/column is under replication. Currently, to change a constraint, we remove the machine from replication, delete the constraint and replace it with a new one then finally add the machine to replication again. Imagine doing that for 20+ computers!

Is there anyone that is aware of an sp_ or know of some T-SQL that can simplify this process?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-05-01 : 01:45:07
you can just drop the article from publication, remove the constraint, add the article back. I think its sp_Droparticle. When you drop/add the article back Replication agent will recreate the table on the publishers, bulk insert the data. So if you have millions of rows in the table, expect some slog time from your agents.

Dinakar Nethi
SQL Server MVP
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

chaos
Starting Member

2 Posts

Posted - 2007-05-03 : 07:34:17
Hi Dinakar,

I will test that and check the results. Sounds like an automated method of what we're currently doing manually.
Go to Top of Page
   

- Advertisement -