I have a problem with a situation when many users insert a record to the database in the same time and in column scope_id there are duplicated values. Is there a way to protect duplication of value?
@scope_id = SCOPE_IDENTITY()
I thought about a trigger but maybe is a simpler solution.(Checking before that id is in the database doesn't always work.)