BUG: Incorrect Identity Value with Self-Referencing FOREIGN KEY Constraint (322818)
The information in this article applies to:
This article was previously published under Q322818
BUG #: 55275 (SQLBUG_70)
SYMPTOMS
If you have a PRIMARY KEY constraint that is defined on an identity column, and you also have a FOREIGN KEY constraint that is defined on the identity column that references itself, SQL Server generates an incorrect identity value. The generated identity value is two times the incremental value that is defined in the identity column property instead of one times the incremental value.
Additionally, the @@IDENTITY system function returns an incorrect value. Instead of returning the last-inserted value, it returns the last-inserted value, and the incremental seed value.
WORKAROUND
To work around this problem, remove the self-referencing FOREIGN KEY constraint on the column.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 7/17/2002 |
---|
Keywords: | kbbug KB322818 |
---|
|