Unique constraints can be created when initially creating the table or added after.
7> CREATE TABLE Employee (
8> EmployeeID Int IDENTITY(1,1) NOT NULL
9> , LastName nVarChar(50) NOT NULL
10> , FirstName nVarChar(50) NOT NULL
11> , SSN Char(9) NOT NULL
12> , CONSTRAINT U_SSN UNIQUE NONCLUSTERED (SSN))
13> GO
1> ALTER TABLE Employee
2> ADD CONSTRAINT U_SSN UNIQUE NONCLUSTERED (SSN)
3> GO
1> drop table Employee;
2> GO
|