This one is going to be a controversial one. But the bottom line is every now and then you want to do something and then you curse and wish your database didn't have identities. So why use them? Let's look at the problems first:
❌ Cons
In Microsoft Access you have autonumbers and there is no way around them so never use them. But in SQL Server you have identities and we have these procs:
So the only Con left is the importing of data but we can use one of the above procs to get around it. See grey box.
Using SQL Management Studio
Figure: SQL Import Wizard - Edit Mappings
Figure: SQL Import Wizard – Ensure Enable identity insert is checked
Alternatively, you can also enable and disable the identity insert through SQL with the following commands:
SET IDENTITY_INSERT Shippers ON --this will allow manual identity INSERTS on the requested table-- Modify the table hereSET IDENTITY_INSERT Shippers OFF --as it can only be on for one table at a time
More information on IDENTITY_INSERT
The simplest way of handling identity ranges across replicas is to allow SQL Server to manage identity range handling for you. To use automatic identity range handling, you must first enable the feature at the time the publication is created, assign a set of initial Publisher and Subscriber identity range values, and then assign a threshold value that determines when a new identity range is created. For example, assigning an identity range from 1000 through 2000 to a Publisher, and a range from 2001 through 3000 to an initial Subscriber a range from 3001 to 4000 to the next publisher etc.