By joking with a collage, I came from an interesting scenario: is it possible that SQL Server defines a table So that "standard meanings" (obstacles, etc.) can I make sure that two or more columns are mutually exclusive?
I mean: can I make sure that only one of the columns is included in the column?
Yes, you can use a check barrier:
ALTER TABLE YourTable ADD contract obligation check (call 1 blank or call 2 is empty)
According to your comment, if multiple columns are unique, You can check them like this:
When call 1 is zero then 0 and 1 end + case when call 2 is zero, then 0 and 1 end + case when call 3 is zero , Then 0 and 1 end + case when call 4 is zero, then 0 and 1 end = 1
say this Land should be one of the values of the four columns. If they can all be taped, then simply & lt; = 1
.
No comments:
Post a Comment