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 - Unusual behaviour when drawing lots of images onto a large canvas -

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

javascript - Chart.js - setting tooltip z-index -