Why would you NOT set IGNORE_DUP_KEY to ON?

后端 未结 5 628

IGNORE_DUP_KEY = ON basically tells SQL Server to insert non-duplicate rows, but silently ignore any duplicates; the default behavior is to raise an error and a

5条回答
  •  离开以前
    2021-01-04 22:27

    Whenever there is a deviation from the "normal" in the database , you probably want to know about it.

    You kept the key unique because of some constraint arising out of business need that dictated it. The database is just keeping up it's side of the deal saying that 'hey you wanted this to be unique but now you are saying something contrary. Make up your mind'

    If that is intentional you can ask database to shut up by using IGNORE_DUP_KEY :)

提交回复
热议问题