MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to update part of varchar column

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
byhalia
Beginner


Joined: 30 Aug 2006
Posts: 9
Topics: 3

PostPosted: Wed Oct 18, 2006 3:10 pm    Post subject: How to update part of varchar column Reply with quote

Before letting this Q here i have checked the forum and found this

http://www.mvsforums.com/helpboards/viewtopic.php?t=6378&highlight=update

it did not worked as the field i am updating is varchar of length 256.

i need to put a constant of XXX in the first three bytes no matter whatever is in rest 4 to 256 bytes.

Thanks
Byhalia
Back to top
View user's profile Send private message
byhalia
Beginner


Joined: 30 Aug 2006
Posts: 9
Topics: 3

PostPosted: Wed Oct 18, 2006 3:11 pm    Post subject: Reply with quote

can this happen in a single query. any number of queries how should i do it.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Oct 18, 2006 4:00 pm    Post subject: Reply with quote

byhalia,


Try this

Code:

UPDATE TABLE                                         
   SET your_varchar_col = 'XXX' CONCAT SUBSTR(your_varchar_col,4,253);     


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
byhalia
Beginner


Joined: 30 Aug 2006
Posts: 9
Topics: 3

PostPosted: Fri Oct 20, 2006 5:39 am    Post subject: Thanks Reply with quote

it is working.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group