combining data from two identity fields

  • hello,

    i am working on a project where we have two databases, one inside our firewall and one outside. so the databases cannot communicate with each other on a regular basis. both databases have a single document table, each with a documentID identity field. the internal database has an identity seed of 1 and the external database starts the seed at 1000000. i thought that i could just remove the identity and move the data from the external table into the internal table, then put the identity column back with a low seed resulting in the two tables never having the same documentID (provided we don't go over a millin documents internally - which is unlikely) however, when i put the identity specification back on the internal table after i move the data over from the external table, even with a low seed number, the next identity it creates is above 1 million. any ideas how best to create an unique identity in two different tables in two different databases and synch them up daily ensuring the ID fields will remain unique?

    all help very much appreciated!

    thanks,

    brian 

  • Brian

    Have a look at the topic SET IDENTITY_INSERT ON in Books Online.  You will want to pay particular attention to the following line:

    If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value

    Maybe if the external table had the lower values you would have more luck.

    John

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply