sql server unique key for each partition -


i have table contain 3 columns:

id int [primary key]

branchref int [foreign key]

code int

i need [code] unique in each [branchref]

like:

id      branchref      code 1           1            1 2           1            2 3           2            1 4           2            2 5           1            3 

i appreciate help

add unique constraint.

alter table mytable add constraint unique(branchref, code); 

Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -