all groups > sql server replication > may 2004 >
You're in the

sql server replication

group:

Adding Identity column to existing table.


Adding Identity column to existing table. Bill Mitchell
5/27/2004 5:18:38 PM
sql server replication:
I am trying to add a server managed ranged Identity column to an existing
table in my database and then have SQL Server provide the management of
subscribers ranges.

I have had success with this using a test database (a book walk-though
example) but now I want to add this to a real table in my production
environment (actually a copy of the database) and then test with several
Pocket PC Sql Server CE subscribers using merge replication.

I added a column named MyIdentity as a 'int' type and choose the 'Not for
Replication' option.

I have it set up with horizonal filtering using suser_sname() which is
correct giving each subscriber only the appropriate records.

The problem is that under 'Articles', 'Identity Ranges', the settings are
disabled as if they are not an option with the article I added the
MyIdentity column to.

Any ideas as to how to get this working. Your help is greatly appreciated.

Bill Mitchell

Re: Adding Identity column to existing table. Paul Ibison
5/28/2004 9:23:27 AM
Bill,
when you create the publication there is a checkbox which gives the option
to 'automatically assign and maintain a unique identity range for each
subscription'. If this is not checked when you create the subscription then
it is assumed you will manually set the ranges and the option is then greyed
out. Please can you recreate the publication to check this is the case.
BTW setting it manually can also be useful (see
http://www.mssqlserver.com/replication/bp_replication_with_identity.asp).
HTH,
Paul Ibison

Re: Adding Identity column to existing table. Bill Mitchell
5/28/2004 10:11:33 AM
Paul,

Thanks, I think maybe I understand what was wrong earier. I tried your
suggestion but there was no tab on the article properties dialog as I was
creating the publication. Finally I added in a column as 'int' with the
Replicated set to "Yes". Then when I created the publication, the tab was
there and allowed me to choose for the server to manage the ranges.

If I understand correctly (I'm quite new to SQL Server), each table in a
merge replication solution in which the subscribers will be adding records
will need a single "int" column with the replication set to "Yes" prior to
creating the publication. Then during the creation of the publication, I
need to make sure and check for each of these tables (articles) ranges to be
managed. Is this correct and am I missing anything in this statement?

Thanks again,
Bill

[quoted text, click to view]

Re: Adding Identity column to existing table. Bill Mitchell
5/28/2004 1:45:54 PM
Thanks for all of your help.
Bill

[quoted text, click to view]

Re: Adding Identity column to existing table. Paul Ibison
5/28/2004 4:24:03 PM
Bill,
for merge you need the column specified as Yes Not For Replication on the
publisher. When creating the publication there is the checkbox to have SQL
Server manage identity ranges we talked about. On the subscriber there
should be the same Identity Yes Not For Replication attribute. This allows
the replication process to do identity inserts. The ranges avoid clashes. If
you are not going to have SQL Server manage the ranges then you can manually
do it yourself. This is required if you are doing a nosync subscription ie
the subscriber already has the data so the initialization process won't send
it down. There are details on Michael Hotek's site of nice algorithms to
avoid identity clashes (http://www.mssqlserver.com/replication/).
HTH,
Paul Ibison

Re: Adding Identity column to existing table. SqlJunkies User
8/9/2004 8:21:57 AM
Never mind...I found it.
It's when I add an article I needed to go into this article's properties to set it before generating the snapshot.

Vince

---
Posted using Wimdows.net NntpNews Component -

AddThis Social Bookmark Button