PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > Duplicate key ignored AND statement terminated
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Duplicate key ignored AND statement terminated

Réponse
 
LinkBack Outils de la discussion
Vieux 20/03/2008, 23h12   #1
traceable1
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Duplicate key ignored AND statement terminated


I have a table with a unique non-clustered index on it. It has the
IGNORE_DUP_KEY option on.

For some reason, I am getting the following error:

-----------------------------------------------------------------------------
System.Data.SqlClient.SqlException: Cannot insert duplicate key row in
object 'dbo.table1 with unique index 'IX_table1'.

Duplicate key was ignored.

The statement has been terminated.
------------------------------------------------------------------------------


It says the duplicate key was ignored, yet the statement is still
terminated

Is this data related?



Other databases in the instance are working fine, and this one was
doing okay, too.

We're running SQL Server 2005 SP2 with rollup 3; 64-bit; clustered;



thanks for any insight . . . .

traceable
  Réponse avec citation
Vieux 21/03/2008, 00h44   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate key ignored AND statement terminated

traceable1 (thhamlin@gmail.com) writes:
> I have a table with a unique non-clustered index on it. It has the
> IGNORE_DUP_KEY option on.
>
> For some reason, I am getting the following error:
>
> --------------------------------------------------------------------------
> System.Data.SqlClient.SqlException: Cannot insert duplicate key row in
> object 'dbo.table1 with unique index 'IX_table1'.
>
> Duplicate key was ignored.
>
> The statement has been terminated.
> --------------------------------------------------------------------------
>
> It says the duplicate key was ignored, yet the statement is still
> terminated
>
> Is this data related?


It would certainly to see the table definition, including indexes.
Even better the statement that gives this effect.

Without that, the field is open to speculation. For instance, maybe you
submit a batch which first inserts into the table with the IGNORE_DUP_KEY
propery set and the duplicate key is ignored, but then the next statment
violates a unique index which does not have IGNORE_DUP_KEY set.

So the only advice I can give is to first double-check that the error
is on an index with IGNORE_DUP_KEY. Next track down the INSERT statement
and find the data that gives this error.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h44.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10257 seconds with 10 queries