Duplicate Key Values - by Anton Plotnikov

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 470542 Comments
Status Closed Workarounds
Type Suggestion Repros 1
Opened 6/26/2009 12:20:37 AM
Access Restriction Public


When I try to insert duplicate keys in table with unique index I receiving an error message. And it isn't intelligible why key value was duplicated. 

E.g.: Msg 2601, Level 14, State 1, Procedure UserSettingsStorageFiltered__TR__OnInsert, Line 11
Cannot insert duplicate key row in object 'FtmAppInterop.UserSettingsStorage' with unique index 'UserSettingsStorage__IXU__UserFilter'.
Sign in to post a comment.
Posted by Microsoft on 5/28/2010 at 8:34 AM
I have resolved it as a duplicate of connect id - 470542. We will look into it for addressing in the next release of SQL.

Posted by Anton Plotnikov on 7/22/2009 at 8:16 AM
Posted by Microsoft on 7/21/2009 at 6:08 PM
Anton: thanks for contacting us for the issue. I agree that it will be useful to know which key violated the constraint. I played with following example

create table t(c1 int primary key, c2 int)
create table t_shadow(c1 int, c2 int)
insert into t values (1, 1)
insert into t_shadow values (1, 1)

-- this fails and it is not easy to know which row caused the failue.
-- Msg 2627, Level 14, State 1, Line 2
-- Violation of PRIMARY KEY constraint 'PK__t__3213663B03317E3D'. Cannot insert
-- duplicate key in object 'dbo.t'. The statement has been terminated.
insert into t select * from t_shadow

We will consider looking into it in a future release.