BUG: Command Aborted When Inserting into a IGNORE_DUP_KEY TableLast reviewed: July 30, 1997Article ID: Q171886 |
The information in this article applies to:
SYMPTOMSAn attempt to insert duplicates into a table with the IGNORE_DUP_KEY option set ON may cause an INSERT INTO command to be aborted. The following scripts demonstrate this problem:
SET NOCOUNT ON DROP TABLE t1 GO DROP TABLE t2 GO CREATE TABLE t1 (c INT) CREATE UNIQUE INDEX ind ON t1(c) WITH IGNORE_DUP_KEY SELECT c = 1 INTO t2 UNION ALL SELECT 1 INSERT INTO t1(c) SELECT c FROM t2 WHERE NOT EXISTS (SELECT * FROM t1 WHERE t1.c = t2.c) WORKAROUNDTo work around this problem, do either of the following:
STATUSMicrosoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional query words: tsql transql transact-sql
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |