How to ignore duplicate value Error while inserting the record in unique index?
When unique index is created without any option the default option is IGNORE_DUP_KEY = OFF, which means when duplicate values are inserted it throws an error regarding duplicate value.
such as
Msg 2601, Level 14, State 1, Line 9
Cannot insert duplicate key row in object 'dbo.QODT4' with unique index 'Q4_INDEX'.
If option is set with IGNORE_DUP_KEY = ON then the duplicate values are inserted it does not thrown an error but just displays warning.
such as
(1 row(s) affected)
Duplicate key was ignored.
Comments
Post a Comment