Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

partial update in DB2 column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: partial update in DB2 column
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    Post subject: Reply to: partial update in DB2 column
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    Post subject:
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    Post subject:
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    Post subject:
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    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 IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us