sql server add unique constraint code example
Example 1: sql server add unique constraint
-- Add a Unique constraint and deifine the constraint name
ALTER TABLE TableName
ADD CONSTRAINT TableName_ColumnName_Unique UNIQUE (ColumnName)
Example 2: set column as unique in sql server
ALTER TABLE Persons
ADD UNIQUE (ID);