It's not documented in Books Online, but I've found that while IGNORE_DUP_KEY
is valid for Primary Keys, you can't change it with an ALTER INDEX; you'll have to drop and re-create the primary key.
Keep in mind that IGNORE_DUP_KEY
doesn't allow you to actually store duplicate rows in a unique index, it simply changes how it fails when you try it:
ON: A warning message will occur when duplicate key values are inserted
into a unique index. Only the rows violating the uniqueness
constraint will fail.
OFF: An error message will occur when duplicate key values are inserted
into a unique index. The entire INSERT operation will be rolled
back.
From http://msdn.microsoft.com/en-us/library/ms175132.aspx
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…