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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -