Skip to Content
Custom Search

Adding Primary Key on exisitng DB2 Table

 

 
 
 
 
 
 
 
 
 
 
 
Adding Primary Key on exisitng DB2 Table
 
 
How to defina a primary key on an existing DB2 table?
 
 
To define a primary key on a table which exists you will need
to use the ALTER command, the following example query will give 
you the intended result
 
 
ALTER TABLE Table_Name ADD PRIMARY KEY (Column_one, Column_two)
 
Where Table_Name is the name of the DB2 table for which you wish to 
change the primary key and Column_One and Column_two are the column 
names which will be used as Primary Key.
; ; ; ;

Comments

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 25 guests online.
Dr. Radut | page