How to add composite primary key to table
foreign-keys, primary-key, sql, sql-server-2005
Solution
In Oracle, you could do this:
create table D (
ID numeric(1),
CODE varchar(2),
constraint PK_D primary key (ID, CODE)
);
Problem
``` create table d(id numeric(1), code varchar(2)) ``` After I create the above table how can I add a composite primary key on both fields and also a foreign key?