How to create composite primary key in SQL Server 2008

Viewed 382123

I want to create tables in SQL Server 2008, but I don't know how to create composite primary key. How can I achieve this?

8 Answers
CREATE TABLE UserGroup
(
  [User_Id] INT Foreign Key,
  [Group_Id] INT foreign key,

 PRIMARY KEY ([User_Id], [Group_Id])
)
Related