Saturday, 12 July 2014

How to Create 2 Priary keys in a table


create table MyTest
(
Id int primary key,
SNo int primary key
)
if you execute above statements you will get below error
Cannot add multiple PRIMARY KEY constraints to table 'MyTest'.
So we can create 2 primary keys using below code.
create table MyTest
(
Id int primary key,
SNo int primary key
)