set column as unique in sql server
snippet in sql

set column as unique in sql server

user7016

ALTER TABLE Persons
ADD UNIQUE (ID);

unique constraint mssql

user7571

USE AdventureWorks2012;  
GO  
CREATE TABLE Production.TransactionHistoryArchive4  
 (  
   TransactionID int NOT NULL,   
   CONSTRAINT AK_TransactionID UNIQUE(TransactionID)   
);   
GO