UNIQUE constraint controlled by a bit column

后端 未结 3 1308
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 05:41

I have a table, something like

FieldsOnForms(
 FieldID int (FK_Fields)
 FormID int (FK_Forms)
 isDeleted bit
)

The pair (FieldID,FormID) s

3条回答
  •  温柔的废话
    2020-12-11 06:24

    No, unique means really unique. You'll either have to move your deleted records to another table or change IsDeleted to something that can be unique across all deleted records (say a time stamp). Either solution will require additional work either in your application, in a stored procedure, or in a trigger.

提交回复
热议问题