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

sql server replication

group:

forcing an identity to be even\odd



forcing an identity to be even\odd Svur
6/30/2004 11:58:23 AM
sql server replication: Hi
I am not able to implement even odd series, the tables
are generating autonumbers with 'last value + 2' for the
next value (inspite of saying identity seed is 2 and
increment is 2). thisway, if the last value on
a 'supposed' even table is turming odd if the last merged
value is odd. is their a way to force newly generated
autonumbers to be only odd in odd table and only even in
even table. something like a formula?

Thanks
Re: forcing an identity to be even\odd Paul Ibison
6/30/2004 8:53:30 PM
SVur,
this is how I set it up. On the publisher I set the seed at 1 and increment
at 2 to give odd numbers. I replicated this table to the subscriber. After
initialization I dropped the subscription. On the 'subscriber' I changed the
seed and increment to 2 and 2. I recreated the subscriber using the nosync
option and it all worked OK. You could also probably do this more directly
using @creation_script on sp_addmergearticle.
HTH,
Paul Ibison

Re: forcing an identity to be even\odd SVur
7/1/2004 7:47:18 AM
Hi Paul,
I tried to implement the way you described, but for some
reason, the identity of the new value is always the
current value + 2, irrespective of what the seed is.
I have no clue as to what goes into @creation_script, i
have not been able to find any articles online aswell.
i would appreciate if you could help me out with this

Thanks
SVur
[quoted text, click to view]
Re: forcing an identity to be even\odd SVur
7/1/2004 10:03:39 AM
Hi paul,
Please find the script below:

/****** Object: Table [dbo].[Tasks] Script Date:
7/1/2004 11:34:42 AM ******/

CREATE TABLE [dbo].[Tasks] (

[TaskID] [int] IDENTITY (1, 2) NOT FOR
REPLICATION NOT NULL ,

[UnitOfMeasure] [varchar] (70) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,

[TaskDesc] [varchar] (100) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,

[GUID] uniqueidentifier ROWGUIDCOL NOT NULL

) ON [PRIMARY]

GO

Thanks,
SVur
[quoted text, click to view]
Re: forcing an identity to be even\odd Paul Ibison
7/1/2004 4:21:03 PM
SVur,
please script out your initial table and I'll have a go at creating a script
for you.
Regards,
Paul Ibison

Re: forcing an identity to be even\odd Paul Ibison
7/1/2004 6:26:59 PM
Thanks SVur. At the moment we have two threads going essentially the same
issue (hadn't associated your name) so please let's leave this thread and
continue the previous one where I have posted my answer.
Regards,
Paul Ibison

AddThis Social Bookmark Button