14
Create index aborted on duplicate rows. Primary key is 'S_KEY'.
This error occurs when you try to create a clustered index on a table that contains duplicate rows.
Decide whether you want to allow or prevent duplicate rows in the table where the clustered index will be created. Use one of the following procedures.
Create the index with the allow_dup_row option:
1> create clustered index <index_name> on <table_name> 2> with allow_dup_row 3> go
Subsequent update and insert commands can create duplicate rows after the allow_dup_row option is set.
Create the index with the ignore_dup_row option:
1> create clustered index <index_name> on <table_name> 2> with ignore_dup_row 3> go
Existing duplicate rows will be deleted from the table as the index is created. Subsequent attempts to enter a duplicate row with insert or update are ignored and the insert or update is cancelled with an informational message. If the insert or update is part of a larger transaction, the rest of the transaction will continue as usual.
ignore_dup_row and allow_dup_row are mutually exclusive. Using them together in the same create index statement causes error 1916 .
All versions