How can I create a SQL unique constraint based on 2 columns?
You can try this: CREATE UNIQUE CLUSTERED INDEX index_name ON TABLE (col1,col2) or CREATE UNIQUE NONCLUSTERED INDEX index_name ON TABLE (col1,col2) or ALTER TABLE [dbo].[TABLE] ADD CONSTRAINT UNIQUE_Table UNIQUE CLUSTERED ( col1, col2 ) ON [PRIMARY]