views:

24

answers:

1

I want to setup merge replication between two SQL Server 2008 Servers. For the Primary Key’s, I’d like to use a composite key: an identity column plus a column that will denote which server the row was created on (locationID column).

Any ideas on how to do this? I’m not sure if you could use a trigger or a function to insert a default value every time a row is entered, but I’ve read this method is possible – just can’t find detailed steps on how to exactly do it. Thanks for any help or references you can provide!

A: 

In a peer-to-peer transactional replication scenario, I've used a technique of assigning each server a number, which will serve as the ones digit of the identity seed. Then, increment each identity by ten instead of the default 1. So, identities assigned by server 1 are 1, 11, 21, 31, ... and identites assigned by server 2 are 2, 12, 22, 32, ...

Joe Stefanelli
Good idea, thanks! If I had a reputation, I'd vote up your answer.I am still curious how to do the method in my question, if anyone happens to know...
Eta Argus