Identities and Merge Replication on SQL 2000

Identities and Merge Replication on SQL 2000

Post by Matt Este » Tue, 12 Jun 2001 23:59:34



I'm using Merge Replication on SQL 2000 and having trouble with the ID
fields.  Server 02 is the distributor and the table ID column is set to Seed
1 and Increment 2 so that it will insert odd numbers and on Server 01 the
table ID column is set to Seed 2 and Increment 2 for even numbers.  When
data is inserted into the table on Server 01 it is given an odd numbered ID
instead of giving an even ID number.  I checked the table design after
turning on Replication and both ID fields are still set correctly and set to
the NOT FOR REPLICATION option.  Does anyone know how to solve this problem?

Thanks.
Matt

 
 
 

Identities and Merge Replication on SQL 2000

Post by Reinout Hillman » Wed, 13 Jun 2001 03:48:33


Hi Matt,

Is there a reason you want to do it this way? SQL2000 merge replication has
built in identity ranges that it can work with so you don't have to manage
the identity ranges by yourself. You might consider using these as, even if
you got your method to work, it would be hard to add a second or a third
subscriber.

Once again, if there is a reason for you doing it this way, let us know...

Regards,
Reinout


Quote:> I'm using Merge Replication on SQL 2000 and having trouble with the ID
> fields.  Server 02 is the distributor and the table ID column is set to
Seed
> 1 and Increment 2 so that it will insert odd numbers and on Server 01 the
> table ID column is set to Seed 2 and Increment 2 for even numbers.  When
> data is inserted into the table on Server 01 it is given an odd numbered
ID
> instead of giving an even ID number.  I checked the table design after
> turning on Replication and both ID fields are still set correctly and set
to
> the NOT FOR REPLICATION option.  Does anyone know how to solve this
problem?

> Thanks.
> Matt


 
 
 

Identities and Merge Replication on SQL 2000

Post by Matt Este » Wed, 13 Jun 2001 04:05:32


Hi Reinout,

I tried using the built in identity ranges, but they were inserting large, 9
digit, numbers and my boss wants to keep the id fields "pretty" and as
simple as possible.  If there is a way to set the numbers that are used I
would be willing to try it again and see if it could solve my problem.  I've
been working on this for a couple of weeks, when time permitted, and have
gotten the even and odd numbered ID's working on some tables after a lot of
work and no clue why it started working.  It seems that if you're using the
NOT FOR REPLICATION option this should work fairly well and be an easy
setup.  I can't understand why odd ID's are being given to inserts on a
table that is set to (2,2) for the increment and seed.
.
I'm not too worried about adding more subscribers because if we up the
number of our systems it will be a global increase and I'll have to redesign
the database anyway to accommodate the new complexities of the business.

Thanks
Matt


> Hi Matt,

> Is there a reason you want to do it this way? SQL2000 merge replication
has
> built in identity ranges that it can work with so you don't have to manage
> the identity ranges by yourself. You might consider using these as, even
if
> you got your method to work, it would be hard to add a second or a third
> subscriber.

> Once again, if there is a reason for you doing it this way, let us know...

> Regards,
> Reinout



> > I'm using Merge Replication on SQL 2000 and having trouble with the ID
> > fields.  Server 02 is the distributor and the table ID column is set to
> Seed
> > 1 and Increment 2 so that it will insert odd numbers and on Server 01
the
> > table ID column is set to Seed 2 and Increment 2 for even numbers.  When
> > data is inserted into the table on Server 01 it is given an odd numbered
> ID
> > instead of giving an even ID number.  I checked the table design after
> > turning on Replication and both ID fields are still set correctly and
set
> to
> > the NOT FOR REPLICATION option.  Does anyone know how to solve this
> problem?

> > Thanks.
> > Matt

 
 
 

Identities and Merge Replication on SQL 2000

Post by Reinout Hillman » Wed, 13 Jun 2001 05:05:33


Hi Matt,

Firstly:
I tried to replicate (excuse the pun) what you are doing by changing the
identity seed on the subscriber but I can't seem to see how you are doing
it. What steps do you use to change the identity seed on the subscriber once
you've done the initial merge? The table schema is locked at the subscriber
once you've applied the snapshot to the subscriber.

Secondly:
I'm not too sure where your 9 digit numbers come from because the default
subscriber identity range is 100 meaning that your publisher will have the
range from 1-100 and your subcriber from 101-200. Are you using an INT as
your identity column? Check BOL (replsql.chm::/repldata_078z.htm) for more
information regarding changing of the default range settings.

-R


> Hi Reinout,

> I tried using the built in identity ranges, but they were inserting large,
9
> digit, numbers and my boss wants to keep the id fields "pretty" and as
> simple as possible.  If there is a way to set the numbers that are used I
> would be willing to try it again and see if it could solve my problem.
I've
> been working on this for a couple of weeks, when time permitted, and have
> gotten the even and odd numbered ID's working on some tables after a lot
of
> work and no clue why it started working.  It seems that if you're using
the
> NOT FOR REPLICATION option this should work fairly well and be an easy
> setup.  I can't understand why odd ID's are being given to inserts on a
> table that is set to (2,2) for the increment and seed.
> .
> I'm not too worried about adding more subscribers because if we up the
> number of our systems it will be a global increase and I'll have to
redesign
> the database anyway to accommodate the new complexities of the business.

> Thanks
> Matt



> > Hi Matt,

> > Is there a reason you want to do it this way? SQL2000 merge replication
> has
> > built in identity ranges that it can work with so you don't have to
manage
> > the identity ranges by yourself. You might consider using these as, even
> if
> > you got your method to work, it would be hard to add a second or a third
> > subscriber.

> > Once again, if there is a reason for you doing it this way, let us
know...

> > Regards,
> > Reinout



> > > I'm using Merge Replication on SQL 2000 and having trouble with the ID
> > > fields.  Server 02 is the distributor and the table ID column is set
to
> > Seed
> > > 1 and Increment 2 so that it will insert odd numbers and on Server 01
> the
> > > table ID column is set to Seed 2 and Increment 2 for even numbers.
When
> > > data is inserted into the table on Server 01 it is given an odd
numbered
> > ID
> > > instead of giving an even ID number.  I checked the table design after
> > > turning on Replication and both ID fields are still set correctly and
> set
> > to
> > > the NOT FOR REPLICATION option.  Does anyone know how to solve this
> > problem?

> > > Thanks.
> > > Matt

 
 
 

Identities and Merge Replication on SQL 2000

Post by Matt Este » Wed, 13 Jun 2001 05:31:38


Thanks, Reinout.  I'll try to answer your questions and explain it a little
bit better.

I have created the two tables on each database and set their seed and
increment values then.  The table on the publisher already has data in it,
so when I turn on replication I set the Article defaults to Keep the
existing table unchanged.  This allows the subscriber table to stay at (2,2)
while the publisher is set to (1,2).  I really don't make any changes to the
subscriber after initializing merge.  This does work sometimes, but there is
nothing consistant that I have done to get it to work.  It is more like
dropping and re-initializing the merge until the ID's decide to work.

I'm not too sure where the 9 digit numbers came from either.  The tables I
was trying it on at the time already had several thousand rows in them so
maybe it had something to do with the fact that there were already ID's in
the table for the existing rows.  I tried it on another table, a newly
created one a minute ago and it was giving single digit numbers on Server 02
and Server 01 started at 202.  I might be able to live with that on new
tables, but it would be difficult to change the existing tables, there are
some tables where the ownership by ID, like what Team the information is
for, is set manually when data is entered.  Basically, changing existing
table ID's from the current format, atleast on those where it is working,
would take quite a while to update all of the tables and rows using those ID
fields.  I may end up having to rebuild it all, but I would prefer not to if
I can keep from it, my deadline is Friday.  I have read a lot of  BOL
articles and searched the knowledge base and msdn, but I don't know that I
have seen the article that you are talking about so I'll take a look.

Thanks,
Matt


> Hi Matt,

> Firstly:
> I tried to replicate (excuse the pun) what you are doing by changing the
> identity seed on the subscriber but I can't seem to see how you are doing
> it. What steps do you use to change the identity seed on the subscriber
once
> you've done the initial merge? The table schema is locked at the
subscriber
> once you've applied the snapshot to the subscriber.

> Secondly:
> I'm not too sure where your 9 digit numbers come from because the default
> subscriber identity range is 100 meaning that your publisher will have the
> range from 1-100 and your subcriber from 101-200. Are you using an INT as
> your identity column? Check BOL (replsql.chm::/repldata_078z.htm) for more
> information regarding changing of the default range settings.

> -R



> > Hi Reinout,

> > I tried using the built in identity ranges, but they were inserting
large,
> 9
> > digit, numbers and my boss wants to keep the id fields "pretty" and as
> > simple as possible.  If there is a way to set the numbers that are used
I
> > would be willing to try it again and see if it could solve my problem.
> I've
> > been working on this for a couple of weeks, when time permitted, and
have
> > gotten the even and odd numbered ID's working on some tables after a lot
> of
> > work and no clue why it started working.  It seems that if you're using
> the
> > NOT FOR REPLICATION option this should work fairly well and be an easy
> > setup.  I can't understand why odd ID's are being given to inserts on a
> > table that is set to (2,2) for the increment and seed.
> > .
> > I'm not too worried about adding more subscribers because if we up the
> > number of our systems it will be a global increase and I'll have to
> redesign
> > the database anyway to accommodate the new complexities of the business.

> > Thanks
> > Matt



> > > Hi Matt,

> > > Is there a reason you want to do it this way? SQL2000 merge
replication
> > has
> > > built in identity ranges that it can work with so you don't have to
> manage
> > > the identity ranges by yourself. You might consider using these as,
even
> > if
> > > you got your method to work, it would be hard to add a second or a
third
> > > subscriber.

> > > Once again, if there is a reason for you doing it this way, let us
> know...

> > > Regards,
> > > Reinout



> > > > I'm using Merge Replication on SQL 2000 and having trouble with the
ID
> > > > fields.  Server 02 is the distributor and the table ID column is set
> to
> > > Seed
> > > > 1 and Increment 2 so that it will insert odd numbers and on Server
01
> > the
> > > > table ID column is set to Seed 2 and Increment 2 for even numbers.
> When
> > > > data is inserted into the table on Server 01 it is given an odd
> numbered
> > > ID
> > > > instead of giving an even ID number.  I checked the table design
after
> > > > turning on Replication and both ID fields are still set correctly
and
> > set
> > > to
> > > > the NOT FOR REPLICATION option.  Does anyone know how to solve this
> > > problem?

> > > > Thanks.
> > > > Matt

 
 
 

Identities and Merge Replication on SQL 2000

Post by Venkatesh Bidarka » Fri, 15 Jun 2001 15:57:03


Hi Matt

Try this one.

Once the subscriber database is installed (on Server 01) you have to change the seed on the subscriber database to an even number higher than the max odd number on the publisher database. You have to do this to every table that you are merging. If you are taking a snapshot across to populate the subscriber database, then you do a snap shot and befor you start inserting new records into subscriber database, you have to change the seed as above. (I think to do so you have to take out the articles from the publication and change the seed.)

This has worked for me on SQL7.

Let me know how it goes.

Cheers

Venkatesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

1. merge replication performance for SQL Server 2000 and MSDE 2000

Hi all,

We are designing a model in which we have a SQL Server 2000 in HQ, and 50
remote centers with MSDE 2000. We are planning to use Merge Replication with
Dynamic Filters, and Pull Subscription in remote centers.

Each center MSDE 2000 will store some information private to that office,
and some common information among all centers.

The replication will start in remote centers from mid night, and each center
will start the pull subscription 3 min after the other. For example, center
#1 start at 00:00, center #2 start at 00:03
and center #3 start at 00:06, and so on. As mentioned, there will be some
common information among the centers, I think it is necessary to run the
pull subscriptions again at 03:00, starting from center #1. Any other
suggestion? e.g using push subscriptions at 03:00 in HQ?

Any comment on the performance of this model? Assuming there will be 1000
transactions involved in each center during replication, transaction size is
5K Bytes.

Thanks.

2. Not Initialized for Network Error with Lantastic

3. IMPORTANT Merge replication beetwen sql server 2000 and access 2000 + Msde

4. ORACLE MANUFACTURING/ Contract--Long Term/ N.Car

5. SQL 2000 sp2 messes up SQL - Access merge replication

6. JDBC and File DSNs

7. Merge Replication problem SQL 2000 to SQL 7

8. Stopping SQL Server

9. Merge replication with identity value ranges using not for replication option

10. SQL 2000 syncronisation failing (Merge Replication)

11. Remarks on merge replication by SQL 2000

12. Merge Replication Question in SQL Server 2000

13. SQL 2000 merge replication with SSCE version 1.0.2202.2