Why would you NOT set IGNORE_DUP_KEY to ON?

后端 未结 5 602

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:12

    I'm having a many-to-many relation. I have a product-to-category table with unique index, no other data than prodid and katid in table.

    So I'm setting IGNORE_DUP_KEY on the unique (prodid,katid) index.

    So I can safely say "add product (1,2,3) to category (a,b,c)" without having to check if some products are in some categories already; I only care about the end result.

提交回复
热议问题