unique columns sql code example
Example 1: DISTINCT SQL
SELECT DISTINCT column1, column1, ..... FROM TABLE
/*DISTINCT WILL NOT SELECT THE SAME VALUES IN SAME COLUMN*/
Example 2: unique constraint mssql
USE AdventureWorks2012;
GO
CREATE TABLE Production.TransactionHistoryArchive4
(
TransactionID int NOT NULL,
CONSTRAINT AK_TransactionID UNIQUE(TransactionID)
);
GO