Page 1 of 1

Rebuild Index Failed - SQL Server 2000

Posted: Sun Jun 13, 2010 11:36 am
by sudhakar
Hi,

While running the rebuild index on the database it is getting failed with below error message.

Rebuilding indexes for table 'XXXXX' [Microsoft SQL-DMO (ODBC SQLState: 23000)] Error 1505: [Microsoft][ODBC SQL Server Driver][SQL Server]CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is 'type 24, len 16'. [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.

Please guide me how to simulate this error and resolve.

Re: Rebuild Index Failed - SQL Server 2000

Posted: Mon Jun 14, 2010 10:07 am
by ManU
Hi Sudhakar,

Duplicate key in your database produces the issue. So it is the issue related to the data in your database and can't say as a database issue.

You may find rows with duplicate id's from the following procedure

Do like:

Code: Select all

select id, count(id) from "name"

group by id

having count(id) > 1
Create the UNIQUE index and thereby solve the issue.