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
 

 

Change the length of column using ALTER

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
shriya reddy
Warnings : 1

New User


Joined: 05 Jun 2004
Posts: 43

PostPosted: Tue Nov 16, 2004 11:40 pm    Post subject: Change the length of column using ALTER
Reply with quote

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
View user's profile Send private message

shriya reddy
Warnings : 1

New User


Joined: 05 Jun 2004
Posts: 43

PostPosted: Fri Nov 19, 2004 6:23 pm    Post subject:
Reply with quote

Hi Friends,

Anybody give me the answer.

Bye
shriya.
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Thu Dec 09, 2004 2:28 pm    Post subject: Here is your answer...
Reply with quote

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
View user's profile Send private message
shriya reddy
Warnings : 1

New User


Joined: 05 Jun 2004
Posts: 43

PostPosted: Fri Dec 10, 2004 9:08 am    Post subject:
Reply with quote

Hi OV Reddy


thanks for reply

Shriya
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Nov 14, 2005 3:22 pm    Post subject: changin the length
Reply with quote

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
View user's profile Send private message
Kavitha Palani

New User


Joined: 16 Nov 2005
Posts: 8

PostPosted: Tue Nov 22, 2005 5:06 pm    Post subject:
Reply with quote

ALTER TABLE <TABLE NAME> COLUMN<COLUMN NAME> SET <DATA TYPE > (35)
Back to top
View user's profile Send private message
sri.mainframes

New User


Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

PostPosted: Thu Jun 01, 2006 7:36 pm    Post subject: Re: Change the length of column using ALTER
Reply with quote

Hi Shreya

try this one

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

this will work

regards
PRINCE
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm


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