I would like to enforce a constraint on an SQL Server table as follows:
Table definition
ComputerID autoinc
ComputerName varchar(255)
Username varchar(255)
IsDefault bit
ComputerName may have multiple records with the same value but only one of them should have IsDefault set to 1. The constraint should not allow the same ComputerName to have multiple records with IsDefault = 1.
How can this be achieved?
Table definition
ComputerID autoinc
ComputerName varchar(255)
Username varchar(255)
IsDefault bit
ComputerName may have multiple records with the same value but only one of them should have IsDefault set to 1. The constraint should not allow the same ComputerName to have multiple records with IsDefault = 1.
How can this be achieved?