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

partial update in DB2 column


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

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri Feb 27, 2009 12:05 pm
Reply with quote

Hi ,

i want to update one column of length 8 bytes wherein first 2 bytes is having different values.

i want to update the table column such that first 2 bytes are replaced by 47.

Ex:

Code:
TABLE CURRENT VALUE :

SEQ NUMBER
62354
23445
23325
25232
23234

REQUIRED VALUE :
47354
47445
47325
47232
47234


Thanks in advance.
Jaspal
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Fri Feb 27, 2009 12:46 pm
Reply with quote

Hi Jaspal,
Update
Set SUBSTR(CHAR(SEQ NUMBER),1,2) = 47
will do it for you i think
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Feb 27, 2009 1:18 pm
Reply with quote

what is the datatype of 'SEQ NUMBER' (which is not a valid db2 column name)
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri Feb 27, 2009 1:58 pm
Reply with quote

Hi dbzTHEdinosauer,

Actual field name is I_Account and is Numeric.

Thanks,
Jaspal
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Feb 27, 2009 3:07 pm
Reply with quote

numeric is not a db2 datatype - integer, etc are numeric datatypes.

the casting for the substr depends on knowing the exact datatype of the column.
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 How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Find the occurrence of Key Field (Par... DFSORT/ICETOOL 6
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top