Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Modify table - Merge Replication Expand / Collapse
Author
Message
Posted Wednesday, March 11, 2009 11:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 11, 2009 2:16 PM
Points: 7, Visits: 21
Hi,

I'm a bit confused with something, I know that I can't modify a field while in a merge replication in Sql Server 2000. Well it's possible but it's also a long and painfull challenge.


But I got a problem, some of my tables got a "auto-inc" field as primary key. It give me all short of bug and eventually data lost.

So I tryed to modify the Primary Key of the table and... it actually worked... So my question is...

Can we really modify the primary key of a table while in Merge Replication? I always thought that if I can't modify a field, I can't modify the primary key. :D

Well, that's it...

thanks you
Post #673548
Posted Thursday, March 12, 2009 9:45 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, July 17, 2014 10:43 AM
Points: 3,309, Visits: 6,700
Since it is SQL 2000, You will have to you will have to drop it out of Replication and then alter it and then add it back. Psuedo code for it that I use is like this.

1. exec sp_dropsubscription

2. sp_droparticle

3. Alter the table. Do what ever you want.

4. sp_addarticle

5. sp_refreshSubscriptions

6. exec sp_reinitsubscription

This si the method I know. Maybe someone has a better way.


-Roy
Post #674384
Posted Thursday, March 12, 2009 9:53 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 11, 2009 2:16 PM
Points: 7, Visits: 21
Hmmm,

Usually when you modify a table from a replication, you get an error. But what I'm asking is why I got no error when I modify the Primary Key.

If I got no error that mean I can modify the Primary Key without stopping the replication or deleting the article?

Don't forget I'm in a merge replication.
Post #674395
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse