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

CHANGE TYPE COLUMN


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
perez_a

New User


Joined: 02 Feb 2006
Posts: 25
Location: Italy

PostPosted: Thu Apr 13, 2006 8:06 pm
Reply with quote

HI FRIENDS,
IS POSSIBLE TO CHANGE THE TYPE OF A COLUMN?
EX:

LEVEL CHAR (02) ---------------> LEVEL DECIMAL (2, 0)
PLEASE HELP ME!!!
BYE ALEX
Back to top
View user's profile Send private message
Jag

New User


Joined: 07 Dec 2005
Posts: 30
Location: India

PostPosted: Fri Apr 14, 2006 7:11 am
Reply with quote

Hi,

I think this change is not possible..How ever i will check it once again..

Mean while if you are in hurry...There is solution always..


Create a new coulmn with the new data type and copy the old column to the new coulmn and delete the old column..

Cheers,
Jag
Back to top
View user's profile Send private message
sri.mainframes

New User


Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

PostPosted: Mon Apr 17, 2006 12:30 pm
Reply with quote

Hi parez

yes definetly we can change type of a column in db2

see the below example


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

please correct me if i am wrong.

Thanks
sri.prince
Back to top
View user's profile Send private message
r2k1984

New User


Joined: 21 Jun 2005
Posts: 69
Location: chennai

PostPosted: Mon Apr 17, 2006 4:59 pm
Reply with quote

U CAN HAVE THE COMMAND BY MODIFY

ALTER TABLE TABLE NAME MODIFY COLOUMN COLUMNTYPE COLOUMN COLOUMNTYPE.
alter table ram modify address char(2) no decimel(2,0);
iam not sure please check it
Back to top
View user's profile Send private message
krish_mrt

New User


Joined: 15 Apr 2005
Posts: 12
Location: Chennai

PostPosted: Thu May 25, 2006 5:52 pm
Reply with quote

Hi..
The ALTER TABLE statement as specified by sri.mainframes will work only if the existing datatype and the data type to be replaced are of compatible types...
And so, i dont think we can change from CHAR to DECIMAL...

If there are any issues in this pls get back..
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
No new posts first column truncated in search result IBM Tools 13
Search our Forums:

Back to Top