Welcome to MSSQL Forum!
MSSQL Forum - Discussions about Microsoft SQL Server

You are currently viewing our community forums as a guest user. Sign up or
Having an account grants you additional privileges, such as creating and participating in discussions.

SQL server constrains

Discussion in 'Database Design and Database Objects' started by pecito, Mar 8, 2017.

  1. pecito

    pecito New Member

    Hi, I have two problems that I can't fix, would you like for soe help
    I have a table with four fields, two of them are related so only in one of them have to be written value, another have to be NULL. I mean this, if both fields are field1 and field2 the table should look like this:

    field1 field2
    NULL value -- correct
    value NULL -- correct
    NULL NULL -- incorrect
    value value -- incorrect

    Is there a way to make constrains or index, I'm not sure, in definition of the table so the field should be written like the example

    If it is not possible
    The second question is, because of this I'm using MS ACCESS to make records into the table, how in the form
    to check before record if the fields are filled incorrect to alert the user that have to edit inserted information.

    Thanks in advanced.

Share This Page