Skip to Content
Custom Search

Adding new column and altering Primary Key of DB2 Table

No replies
Anonymous

 

 

 

 

 

I had a requirement where I was supposed to add a new column 
to a DB2 table and add this column to the Primary Key contraint.
 
This table already had three columns part of Primary key.
 
As per my solution I decided to 
 
  • Alter the table to add new column
 
  • Drop the existing Primary Key contraint
 
  • and Add a new primary key contraint which has all the four columns
 
Now this query did fail in the third step, i.e while
creating the primary key constraint and gave me some sql error, 
indicating that there does not exist a unique index on the table.
 
Since the column has already got added, I do not want to drop it and 
start all over again, Is it possible to somehow fix the problem 
without restoring and restarting from scratch.
"; ; ; ;
Sponsored Listing

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 1 user and 33 guests online.

Online users

  • Utemiasemgals
Dr. Radut | forum