ALTER TABLE TableA ADD CONSTRAINT CK_BothDepartsNotNull CHECK (departA IS NOT NULL OR departB IS NOT NULL)