Oninit Logo
The Down System Specialists
+1-913-674-0360
+44-2081-337529
Partnerships Contact
Finderr

-371 Cannot create unique index on column with duplicate data.

This CREATE UNIQUE INDEX statement cannot be completed because the column (or columns) contains one or more duplicate rows. You can either create an ordinary index, accepting the duplicate values, or you can modify the table to remove the duplicates. To get a list of the duplicate values in a single column, first create the ordinary index. Then use a SELECT statement such as the following, filling in the table and column names:

SELECT column FROM table main WHERE 1 < ( SELECT COUNT(*) FROM table sub WHERE main.column = sub.column )

This statement can be extended to handle the case of multiple columns using AND.