Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 788
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us