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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -