Question : How to define unique combination between 2 columns of 3

hi experts,

I have 3 columns of ID

the first one is the unique ID
the two others are foreign key

eg :

uniqueId | userId | ProfileId

I have to make the combination of USERID and PROFILE ID => UNIQUE

for instance :

1 | 1 | 1 : OK
2 | 1 | 1 : KO
2 | 2 | 1 : OK

Can you help me to figure it out?


Thank you,

Kind Regards.

Answer : How to define unique combination between 2 columns of 3

You can create a unique index against the two columns. In SSMS, open up the design of your table. Right click in the design tab and select Indexes/Keys. Click the Add button and in the Columns row, either type in your columns or use the "more" button (the ellipse) to view the Index Columns window.
Random Solutions  
 
programming4us programming4us