Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2008-06-18 : 09:32:20
|
| I get this message when doing an insert into : Msg 2601, Level 14, State 1, Line 1Cannot insert duplicate key row in object 'dbo.ElementLocalCharacterised' with unique index 'ElementLocalCharacterised_uq'.The statement has been terminated.Now my question is : does this error mean that all inserts are done, despite those where the unique key produced a conflict? Or does it mean that none of the inserts are done (all are rejected because at least one gave a conflict) ?If the second is the case I would like to know if it is possible to execute the insert into in a way that all inserts are done despite those that raise a conflict? Thanks a lot for any suggestion !Regards, Fabianusmy favorit hoster is ASPnix : www.aspnix.com ! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-18 : 10:01:46
|
No, all records inserted in same batch are rolled back. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-18 : 10:02:24
|
Yes, you can create an index with "Ignore duplicate key" set.If you have an index with this option, all valid records are inserted, and the invalid are not. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2008-06-18 : 10:29:21
|
| Hello Peso !Thanks a lot for your hint - exactly what I was looking for !Regards, Fabianusmy favorit hoster is ASPnix : www.aspnix.com ! |
 |
|
|
|
|
|