Suppose We create a table, with identity disabled:
CREATE TABLE TestIdentity ( Id int NOT NULL, abc varchar(10) NULL, CONSTRAINT PK_ident_test PRIMARY KEY CLUSTERED (id) );
Note : I have no rights to make Primary Key to identity-enabled, so I have to calculate next Id value from the application programme.
Suppose from multiple connections data is inserted in this table, Id field value is generated by C# application code, the problem is in multi-threaded application multiple requests might generate the same id to insert row. In that case SQL server, PK constraint violates.
What is the best solution to reduce PK constraint violation?