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
 
Want to change length from 3 fields to 4 fields using DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
santhunaveen

New User


Joined: 22 Sep 2006
Posts: 33

PostPosted: Wed Mar 07, 2007 4:52 pm    Post subject: Want to change length from 3 fields to 4 fields using DB2
Reply with quote

Hi,

I have a field heving length of 3 characters, now i want to change this as 4 characters using DB2.

Example in table field1 is having value '384', now I want to change this as '0384' in table using DB2 ....

Can i use LIKE for this purpose....

Please help me in this regard.....
Back to top
View user's profile Send private message

vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Wed Mar 07, 2007 5:37 pm    Post subject:
Reply with quote

Are you taking about the data in the field1..?

What is the datatype of field1. Is that CHAR(03)...? Do you need to change that to CHAR(04) ...?

If you want to change it from CHAR(03) to CHAR(04) then get in touch with DBA and make sure all the application programs accessing that table/column are changed accordingly.The DDL of that table needs to be altered. If you are talking about just the data then it could be done with simple SQL query.
Back to top
View user's profile Send private message
santhunaveen

New User


Joined: 22 Sep 2006
Posts: 33

PostPosted: Wed Mar 07, 2007 5:53 pm    Post subject: Re: Want to change length from 3 fields to 4 fields using DB
Reply with quote

Hi,

I want to change data only.......thru sql query how can we do this......can u give me some suedo code for this..............
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Wed Mar 07, 2007 7:30 pm    Post subject:
Reply with quote

UPDATE tablename SET colname = '0'||colname ;
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Wed Mar 07, 2007 7:32 pm    Post subject:
Reply with quote

That will update all the records in the table. Make sure you are correct before you execute the query.
Back to top
View user's profile Send private message
santhunaveen

New User


Joined: 22 Sep 2006
Posts: 33

PostPosted: Thu Mar 08, 2007 6:00 pm    Post subject: Re: Want to change length from 3 fields to 4 fields using DB
Reply with quote

Hi,

Thanks.....it's working fine.......
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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am

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