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

sql server replication

group:

Workarround in identities in Merge Replication to avoid the use of auto identity range


Workarround in identities in Merge Replication to avoid the use of auto identity range Josep
6/12/2007 12:00:00 AM
sql server replication: Hi,

I've some tables where I can only use an ID and auto identity range. But in
some other tables I can have the primary key as [Subscriber_code] + ID. Then
I don't need to use auto identity range. The Subscriber_code it's stored in
the INI file of the application that uses the database so the only problem
that I may have is that a system administrator install the application
without setting the Subscriber_code at the INI file.

But how can I avoid users to insert a Subscriber_code different from its
real Subscriber_code ?

I've some ideas, but none of them seems enough good:
- Use a CONSTRAINT using WITH NOCHECK and NOT FOR REPLICATION.
- Use a TRIGGER using NOT FOR REPLICATION.

In both examples, I should write a script to create these objects with the
desired Subscriber_code in each Subscriber database. I think there can be a
lot of trouble... so how would you do that ? Is there a solution instead of
constraint and triggers ?


Thank you in advance !

Josep.

Re: Workarround in identities in Merge Replication to avoid the use of auto identity range Hilary Cotter
6/12/2007 12:00:00 AM
I am having a hard time understanding your problem. Are you saying that you
need a SQL solution as a failback incase your administrator forgot to
include the ini file in the deployment? I think you need to address your
deployment so that this does not happen.

By auto identity ranges do you mean automatic identity range management? or
do you mean the identity property of the columns?

You can remove the automatic identity constraint and modify the identity
property of the identity column to have a different value, but you have to
be careful doing this as you might assign a range or values which are in use
by other subscribers.

--
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

Re: Workarround in identities in Merge Replication to avoid the use of auto identity range Josep
6/12/2007 12:00:00 AM


Yes, I'm afraid that the system administration forget to configure properly
the Subscriber_code in the INI file. Or he might copy this file to another
Subscriber and forget to change this code....


To avoid this, I would like to know if there's a possible way to avoid
(triggers, constraints, ...).

Yes, I mean the automatic range management. I can avoid of using it in
tables where primary key is Subscriber_code + ID if I can assure that no
insert will be made in one subscriber with a Subscriber_code different that
its.

I don't have any experience with Merge Replications, but for the tests I've
done until now, I've found that automatic range management could be a
"problem maker", so if I can avoid them...


I hope this time I've explain myself better...


Thank you for your help!

Josep.




"Hilary Cotter" <hilary.cotter@gmail.com> escribió en el mensaje
news:OZfmrqOrHHA.4604@TK2MSFTNGP04.phx.gbl...
[quoted text, click to view]

Re: Workarround in identities in Merge Replication to avoid the use of auto identity range Hilary Cotter
6/14/2007 1:25:29 PM
A not for replication check constraint would probably be ideal. perhaps one
that would include sniffing @@servername to dynamically adjust for different
subscribers.

--
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

Re: Workarround in identities in Merge Replication to avoid the use of auto identity range Josep
6/14/2007 6:38:25 PM
I'm sorry Hilary for my english, but my last postt was not a sentence. It
was a question:
How can I prevent Inserts/Updates with a Subscriber_code different than its
Subscriber_code (every subscriber has a unique code)?


Thank you in advance,

Josep.



"Josep" <jmartinez@autec.es> escribió en el mensaje
news:e9huncPrHHA.1508@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]

Re: Workarround in identities in Merge Replication to avoid the use of auto identity range Josep
6/15/2007 6:19:50 PM
Thank you for your help :-)


Regards,

Josep.



"Hilary Cotter" <hilary.cotter@gmail.com> escribió en el mensaje
news:uNRs2jqrHHA.4100@TK2MSFTNGP06.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button