bmsqldev
bmsqldev

Reputation: 2735

Creating Primary Keys on the Table

We have a list of tables in our database with no primary key defined. We have decided to add a primary key on it. Most of the tables have an identity key column. But in most of the stored procedures, we used other columns for data retrieval. I am confused about in which column I need to create the primary key since it will create a clustered index also.

Thanks for help.

Upvotes: 0

Views: 60

Answers (1)

Vaseph
Vaseph

Reputation: 712

You can try this following example;

ALTER TABLE Db.TableName 
ADD CONSTRAINT PK_Id PRIMARY KEY NONCLUSTERED (Id);

Upvotes: 2

Related Questions