I have a table with these fields: ItemID, CategoryID, IsPrimaryCategory.
The combination of ItemID and CategoryID should always be unique and that's the easy part. But I also want a constraint to force just ItemID to be unique but only when IsPrimaryCategory is true.
How could I best accomplish this?