Reputation: 1532
I want my table to prevent duplicate entries only if the value of ColumnA
is equal to a certain value.
For example, let's say there are already two records in my TableA( ColumnA, ColumnB, ColumnC )
with the values ( 0, 'Damage', 'Inc.')
and ( 1, 'Damage', 'Inc.')
.
I'd like my index to allow the insertion of another ( 0, 'Damage', 'Inc.')
, but prevent the insertion of another ( 1, 'Damage', 'Inc.')
. I want only one entry present with ColumnA=1, but there can be several duplicate entries with ColumnA=0. Is this possible?
I found that there are function-based indexes, but I couldn't fit them to work for the expression ColumnA=1
.
Upvotes: 0
Views: 158