This article was previously published under Q308126
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 101917 (SQLBUG_70)
If an insert operation fails with error 2627 on a nonclustered unique index, the sysindexes.rowcnt field (and sysindexes.rows field) may be decremented. This problem occurs when the following conditions are met:
The INSERT statement is inside a transaction.
The table has a clustered index.
The table has a unique nonclustered index which the INSERT statement violates.
The INSERT statement is not the only statement within the transaction; it must be followed by an UPDATE statement.
When you perform an insert operation on a table that contains a clustered index, if the clustered index is not violated, the insert is done, the maintenance of the nonclustered index is done, and the insert then fails during the update of the nonclustered index. During the partial rollback, the changes are not correctly maintained. The row deletion is kept but the initial row insertion is not, so the subsequent update just modifies the sysindexes.rowmodctr column.
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 7.0. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
301511 INF: How to Obtain the Latest SQL Server 7.0 Service Pack
NOTE: The following hotfix was created prior to Microsoft SQL Server 7.0 Service Pack 4.
The English version of this fix should have the following file attributes or later:
Date Version Size File name Platform ---------------------------------------------------------------- 04-AUG-2001 7.00.1004 5,054,736 Sqlservr.exe x86 14-JAN-2001 7.00.978 586,000 Sqlsort.dll x86 04-AUG-2001 7.00.1004 11,641,616 Sqlservr.exe Alpha 14-JAN-2001 7.00.978 593,168 Sqlsort.dll Alpha
NOTE: Because of file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.
You can work around this problem in the following ways:
Change the order of the INSERT and UPDATE statements.
Run a DBCC UPDATEUSAGE statement on the affected table, and then run a DBCC FREEPROCCACHE statement.
Remove the clustered index, or set the nonclustered unique index to clustered.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 7.0 Service Pack 4.