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

Doubt in Adding a Column to a DB2 Table ?


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

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 08, 2008 10:48 am
Reply with quote

Hi,
I have doubt regarding adding a column in DB2 table. A column can be added to a db2 table using ALTER TABLE statement.

But, why most of the DBA's prefer to.
Unload the table
Drop the table
Create the table dropped table with new column.
Create indexes
Load the table

Is there any reason for this process.
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Mon Sep 08, 2008 11:54 am
Reply with quote

IF the column is added not at the end and if its added in between a table only the DBA'S prefer to

Unload the table
Drop the table
Create the table dropped table with new column.
Create indexes
Load the table

If the column is added at the end of the table and if the column is of NOT NULL WITH DEFAULT the tool ( PLA) will capture the change the as ALTER and Not as dropping the table and recreating the same .The case is reverse when the column need to be added as a NOT NULL column
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 08, 2008 11:58 am
Reply with quote

Hi Prasanth, "PLA" you refering to, is it Platinum Tool
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Mon Sep 08, 2008 12:04 pm
Reply with quote

YES Very much .
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 08, 2008 12:09 pm
Reply with quote

What will happen in the CASE of expanding the COLUMN size.
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Mon Sep 08, 2008 12:18 pm
Reply with quote

Expanding the column Size also depends on where the column lies . On analysis using the tool if the column is at the end the Alter would be the statement getting generated.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 08, 2008 8:56 pm
Reply with quote

Hello,

Something else that might be considered is the value of having a common process regardless of the current modification requirement.

The unload, drop, create, re-load works every time.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Sep 09, 2008 8:16 am
Reply with quote

Quote:
Something else that might be considered is the value of having a common process regardless of the current modification requirement. - Dick Scherrer


Quote:
If the column is added at the end of the table and if the column is of NOT NULL WITH DEFAULT... - Prasanth


In this case ALTER would be enough. But, having it as a common process regardless of the current modification.

Wouldn't that be consuming time.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 09, 2008 8:45 am
Reply with quote

Hello,

Quote:
Wouldn't that be consuming time.
Typically, no.

Doing the same process repeatedly (espcially after it is automated) is safer and really takes no significant amount of extra time.

Many organizations do not permit ALTER for production work.

If you are "just playing around", alter might be ok for personal experimentation.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Sep 09, 2008 9:51 am
Reply with quote

Oh, Thank You Dick. I didn't know that.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 09, 2008 11:34 am
Reply with quote

You're welcome icon_smile.gif

d
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
Search our Forums:

Back to Top