One of the column between two columns should be NOT NULL. How to enforce it in schema? One of the column between two columns should be NOT NULL. How to enforce it in schema? sql-server sql-server

One of the column between two columns should be NOT NULL. How to enforce it in schema?


This is possible with using a CHECK constraint:

CHECK (FirstIdentifier IS NOT NULL OR SecondIdentifier IS NOT NULL)

While CHECK constraints are part of the table (and hence "schema"?), they may not fit the desired definition. The above CHECK is not mutually exclusive, but it could be altered to such.

Happy coding.