Question

Hi everyone i have a project i am working on that consists on keeping tables the same at 3 different locations

i pull data that doesnt exist from each of these locations into a corporate table, i then need to send back down to the locations the new data so they are all the same

The table i am pulling from is a identity

My question is in Sql is there any way to make a table a identity without making it a identity as in setting the default value to be the max(id)+1, this is the only way i can figure i can keep the data structure the same without going to replication

Was it helpful?

Solution

The problem is that you're generating records in an IDENTITY field in multiple sources, then unable to combine them without those records being assigned new IDENTITY values.

By using a GUID as your key field, each of the 3 databases can create records which will have a unique ID, and you'll be able to then combine them without issue. You can still have a UNIQUE constraint on the field, but the likelihood of generating the same GUID is astronomically small.

Most replication processes utilize this GUID approach at some level already, so it's a common solution to this problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top