View previous topic :: View next topic
|
Author |
Message |
santhunaveen
New User
Joined: 22 Sep 2006 Posts: 33
|
|
|
|
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 |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
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 |
|
|
santhunaveen
New User
Joined: 22 Sep 2006 Posts: 33
|
|
|
|
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 |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
UPDATE tablename SET colname = '0'||colname ; |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
That will update all the records in the table. Make sure you are correct before you execute the query. |
|
Back to top |
|
|
santhunaveen
New User
Joined: 22 Sep 2006 Posts: 33
|
|
|
|
Hi,
Thanks.....it's working fine....... |
|
Back to top |
|
|
|