The information in this article applies to:
SYMPTOMS
On page 226 of the "Transact-SQL Reference" for SQL Server for Windows NT
(or page 69 of the "Language Reference Guide" for OS/2), it states:
If IGNORE_DUP_KEY is set and you give an UPDATE or INSERT statement that creates duplicate keys, the row that causes the duplicates is not added or changed. In fact, in the case of UPDATE , the row is discarded. When an UPDATE is performed, SQL Server does not behave as explained above. Instead, the UPDATE fails if it will cause a duplicate row in the table. STATUSMicrosoft has confirmed this to be a problem in SQL Server version 4.2 for OS/2 and Microsoft SQL Server versions 4.2, 6.0, and 6.5. MORE INFORMATION
For example, table test (name char(10), age int NULL) has a unique
clustered key with IGNORE_DUP_KEY on column age:
The following query:
fails with the errors:
-and-
According to the manual, it should discard the row smith and update the other two rows (karl and mary) as in the following:
Additional query words: update duplicates Windows NT
Keywords : kbprg SSrvServer SSrvWinNT |
Last Reviewed: November 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |