Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

alter the primar key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
prabahar

New User


Joined: 25 Nov 2005
Posts: 6

PostPosted: Mon Jan 30, 2006 3:52 pm    Post subject: alter the primar key
Reply with quote

We need to add two new columns to an existing table. One of the new column has to be added to the composite primary key. The table already has a composite primary key. Can we alter the primary key and add the new column as a part of primary key.

Suggestios are welcome.
Regards,
Prabahar
Back to top
View user's profile Send private message

khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Jan 30, 2006 5:18 pm    Post subject: primary key
Reply with quote

Quote:
Can we alter the primary key and add the new column as a part of primary key.


Better u can drop the key and again add the same.
Back to top
View user's profile Send private message
senthilssg

New User


Joined: 09 Dec 2005
Posts: 64
Location: USA

PostPosted: Tue Jan 31, 2006 11:39 am    Post subject:
Reply with quote

Hi ,


1. first drop the primary key of the table .
2. after that drop the index on that table .
3. create new index for the table as per the requirement .
4. now using alter table statement

ALTER TABLE SSGSEN.TRIAL_TABLE
ADD PRIMARY KEY (field_name);

uou can add the primary key to the table .


I hope this help you


Regards,
Senthil
Back to top
View user's profile Send private message
prabahar

New User


Joined: 25 Nov 2005
Posts: 6

PostPosted: Tue Jan 31, 2006 4:27 pm    Post subject: Re: alter the primar key
Reply with quote

Thank you all for your timely help

Regards,
Prabahar
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
No new posts ALTER of an IDMS AREA with NEW/OLD pa... Awanti IDMS/ADSO 2 Mon Mar 14, 2016 10:01 pm
No new posts how to alter a vsam using its ddname ... boyti ko JCL & VSAM 11 Thu Nov 19, 2015 10:49 am
No new posts Alter a null column into a not null c... Raghu navaikulam DB2 2 Wed Jul 15, 2015 3:05 pm
No new posts Db2 v10 - Package invalidated on alte... apvardhini DB2 4 Tue Oct 28, 2014 12:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us