A unique constraint : Unique « Constraints « SQL Server / T-SQL






A unique constraint

 


5> CREATE TABLE MyTable (
6>   MyID Int IDENTITY(1,1) NOT NULL , ID Int NOT NULL
7>  , Description nVarChar(50)
8>  , Region nVarChar(10) DEFAULT 'PNW'
9>  , CONSTRAINT MyTable_PK PRIMARY KEY NONCLUSTERED (MyID,ID))
10> GO
1>
2> drop table MyTable;
3> GO

 








Related examples in the same category

1.Add Unique constaint to table creation
2.Adding a UNIQUE Constraint to an Existing Table