constraints on columns while creating the table

  • Hi All,

    I have a small query.

    I want to create a table Material

    In this table i have two columns coulmn1 and column2 which should be unique.

    What constraints should be placed on this columns so that the table should accept only unique values.

    For one column i can use primary key.

    My question for the other column what i have to do excatly.

    Thanks,

    Sandhya

  • Hi Sandhya

    Here an example:

    CREATE TABLE test

    (

    column1 int not null,

    column2 int not null,

    CONSTRAINT PK_test PRIMARY KEY CLUSTERED (column1),

    CONSTRAINT AK_test_column2 UNIQUE (column2)

    )

    Greets

    Flo

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply