• Just as simple as this...

    -- Adding constraint to an existing table

    ALTER TABLE SomeTable WITH CHECK ADD CONSTRAINT [UK_SomeTable_SomeCompositeKey] UNIQUE( KeyColumn1, KeyColumn2 )

    -- Adding constraint when creating new table

    CREATE TABLE SomeTable

    (

    KeyColumn1 INT NOT NULL,

    KeyColumn2 INT NOT NULL,

    CONSTRAINT [UK_SomeTable_SomeCompositeKey] UNIQUE

    (

    KeyColumn1,

    KeyColumn2

    )

    )

    Edit:

    1. The ADDADD thing is the mis-interpretation of SSC, just use single ADD in the query

    2. Added an example of adding constraint in a CREATE statement.

    --Ramesh