Composite key in sql server2008

CGN007
Posted by CGN007 under Sql Server category on | Points: 40 | Views : 3241
The key which uniquely identify the rows of the table and is formed by
combining at least two or more columns is called composite key.

--Creating the table
CREATE TABLE testTable
(
Column1 INT not null,
Column2 INT not null
)

GO
-- Adding the primary key Constraint
ALTER TABLE testTable
ADD CONSTRAINT pk_myConstraint PRIMARY KEY (Column1,Column2)

GO

Comments or Responses

Login to post response