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

Modifying the DB2 Table


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

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Fri Apr 04, 2008 10:58 am
Reply with quote

How can we modify the structure of a DB2 Table.

eg. i have a column with CHAR(10) but, i want it to be CHAR(15) now.
Back to top
View user's profile Send private message
raviprasath_kp
Warnings : 1

New User


Joined: 20 Feb 2005
Posts: 65
Location: chennai

PostPosted: Fri Apr 04, 2008 11:18 am
Reply with quote

use alter command
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Fri Apr 04, 2008 2:11 pm
Reply with quote

We cant use alter command for Char, only we can use for varchar. I think Im Right.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Apr 04, 2008 2:48 pm
Reply with quote

Gautam,

Please go through these two links,

publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/db2/rbafzmstatabl.htm
publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/db2/rbafzmstch2bas.htm
Back to top
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Sat Apr 05, 2008 2:08 am
Reply with quote

To make it clear in DB2, using Alter command, we cannot increase the Character column length.

What you can do is Drop the column which has size as 10 bytes and using the Alter command add a new column with size as 15.

But the problem here is you cannot add the column exactly at the same position where your previous column was. It will be added at the end.

Hope this would help you.
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: Sat Apr 05, 2008 2:48 am
Reply with quote

Hello,

If you drop/add, make sure you have a backup first. . .

You will probably need to reload the 10-char existing data into the new 15-char field.
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 Load new table with Old unload - DB2 DB2 6
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top