IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need help to change primary key !!!


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
RamyaG

New User


Joined: 29 Sep 2004
Posts: 1

PostPosted: Wed Sep 29, 2004 12:16 pm
Reply with quote

Hai ,


I need to change the primary key for an already existing DB2 table .
My doubt is if I change the primary key using the Alter table command , do the index for this new key will be generated or not ? . Now after the alteration how will the Select statements on this table work .. ?will it be using the new Key while selection.Please clarify on this .. Thanks in advance

Regards,
Ramya
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Sat Nov 13, 2004 2:21 am
Reply with quote

first step is to identify the list of programs where the impacted DB2 table
is used.

Second is to analyse what kind of DDL statements used in each of the
program and create a report of it.

If the new filed, is not going to be a part of Index, then Delete/Update
statements will not be affected.
Insert/Select will be impacted based on the usage of the filed

Take an image copy of the table.
Drop the table
Create a new table defination
Load the table from the previous image copy /* here the format differs
so you may use one time program to load this, otherwise you can chagne the syspunch and load*/

now you need to modify the impacted program.
Compile, link-edit and bind all the programs where the table is used.

let me know if you require any additional information.
_________________
Masade,

A Well defined problem is half solved.
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Sat Nov 13, 2004 2:21 am
Reply with quote

Yes you have to use the new key while making selection after the alter
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
No new posts SELECT from data change table DB2 5
Search our Forums:

Back to Top