Identity column SQL Server 2005 inserting same value twice -


I have a stored procedure that is included in a table (where there is an identity column that is not the primary key - PK

We then use scopendentity () to get the inserted value, then there is some argument to generate the primary key field value based on this value, which is then updated back to the table .

Collections in some situations The procedure is called together from more than one process, resulting in "violation of primary key barrier ..." errors.

It appears to indicate that the identification column is the same

The first question - how is this possible?

The second question - How to stop it ... There is currently no error Management is not so I try something / hold I am going to add logic - but I would like to understand properly to deal with this problem completely.

The violation of the primary key

And what you said:

Where there is an identity column No primary key - PK is initially used to generate date / time for a unique value.

It seems like there is no problem with the problem identification column. There is nothing to give, because this is not a primary key, but more date /

Is there a reason that you are not just using an identity column as the primary key?

/ P>


Comments