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

Change the length of column using ALTER


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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
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: 677
Location: NJ

PostPosted: Mon Nov 14, 2005 3:22 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top