Skip to Content
Custom Search

Changing the primary key on existing DB2 Table

 

 
 
 
 
 
 
 
 
 
Changing the primary key on existing DB2 Table
 
 
How to change the primary key on an existing DB2 Table?
 
If you want to change the primary key of a table that already
exists then you can use the following ALTER query
 
ALTER TABLE Table_Name DROP PRIMARY KEY;
 
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 33 guests online.
Dr. Radut | page