How to make a composite key without making it a primary key in SQL Server ? -


how make composite key without making primary key in sql server ?

i have 2 int columns in table , want make them composite key, sadly don't want them set primary key (selecting both columns , select primary key in ssms).

is possible ?

what mean making them composite key ?

do want make them unique (in combination)?

just create unique constraint on them:

alter table dbo.yourtable add constraint uc_yourtable_col1_col2 unique(col1, col2) 

or else want achieve making them composite key ?


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -