IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Change the length of column using ALTER

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DB2
View previous topic :: View next topic  
Author Message
shriya reddy



Joined: 05 Jun 2004
Posts: 45

Posted: Tue Nov 16, 2004 11:40 pm    Post subject: Change the length of column using ALTER  

Hi Friends,

I heard we can the length of column using ALTER Stmt in new versions of DB2. please give how we code to change length of the column.

Regards,
Shriya Reddy.
Back to top  
shriya reddy



Joined: 05 Jun 2004
Posts: 45

Posted: Fri Nov 19, 2004 6:23 pm    Post subject:  

Hi Friends,

Anybody give me the answer.

Bye
shriya.
Back to top  
ovreddy



Joined: 06 Dec 2004
Posts: 200
Location: Keane India Ltd., Hyderabad

Posted: Thu Dec 09, 2004 2:28 pm    Post subject: Here is your answer...  

Hi Shriya,

The following syantax will work. It is available only with DB2 8.2 and higher ok try it out.

ALTER TABLE CUSTOMER COLUMN ADDRESS SET DATA TYPE CHAR (35)
Back to top  
shriya reddy



Joined: 05 Jun 2004
Posts: 45

Posted: Fri Dec 10, 2004 9:08 am    Post subject:  

Hi OV Reddy


thanks for reply

Shriya
Back to top  
khamarutheen



Joined: 23 Aug 2005
Posts: 678
Location: chennai

Posted: Mon Nov 14, 2005 3:22 pm    Post subject: changin the length  

hi frnd,
using alter table u can only increase the present datatype length.. u cannot decrease it. note that carefully.

Eg:
ALTER TABLE CUSTOMER COLUMN ADDRESS SET DATA TYPE CHAR (35)

can be made as
ALTER TABLE CUSTOMER COLUMN ADDRESS SET DATA TYPE CHAR (55)

but cannot
ALTER TABLE CUSTOMER COLUMN ADDRESS SET DATA TYPE CHAR (15)
Back to top  
Kavitha Palani



Joined: 16 Nov 2005
Posts: 9

Posted: Tue Nov 22, 2005 5:06 pm    Post subject:  

ALTER TABLE <TABLE NAME> COLUMN<COLUMN NAME> SET <DATA TYPE > (35)
Back to top  
sri.mainframes



Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

Posted: Thu Jun 01, 2006 7:36 pm    Post subject: Re: Change the length of column using ALTER  

Hi Shreya

try this one

ALTER TABLE <tablename>
ALTER COLUMN <columnname>
SET DATATYPE <newdatatype> ;

this will work

regards
PRINCE
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DB2
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM