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
 

 

Modifying the DB2 Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Modifying the DB2 Table
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    Post subject: Reply to: Modifying the DB2 Table
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    Post subject:
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: 785
Location: Chennai, India

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

Gautam,

Please go through these two links,

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/db2/rbafzmstatabl.htm
http://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    Post subject:
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

Site Director


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

PostPosted: Sat Apr 05, 2008 2:48 am    Post subject:
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    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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
No new posts Getting soc4 on internal table in cobol abdulrafi COBOL Programming 13 Fri May 06, 2016 3:39 pm


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