Dear All !

I have a table member_email. i have 4 columns in it.
Id
Email
CellNumber
Carrier

I want to create constraint who check following conditions,
1-Email can be null if Cellnumber is given , and Cellnumber can be null if email is given.
2-both email and cell number can not be null in one record.
3-If cellnumber is available then carrier should not be null. Carrier will be null if email is given and cellnumber is not available.

Need guidence.

Regards

Thanks for your time pritaeas. I created two constraints here is the code for others.

ALTER TABLE member_email
ADD CONSTRAINT chk_Email_Cell CHECK(
                (cellNbr is not null and email is null)
                or
                (cellNbr is null and email is not null)
    )


ALTER TABLE member_email
ADD CONSTRAINT chk_Cell_Carrier CHECK(
                (cellNbr is not null and Carrier is not null)
                or
                (cellNbr is null and Carrier is null)

    )

Thread is solved.
Regards

commented: Thanks for sharing. +14