Jump to content
thumbelina84

Update Substring

Recommended Posts

mcm mane nak update substring ek?saya nak update kod yg mule dari w update ke z..saya gune script cani tp xmenjadila..tulun tulun!!

update tmpcase_temp

set (case_kodsek,1,1)='Z'

where substr(case_kodsek,1,1)='W'

Share this post


Link to post
Share on other sites

salam,ianya tak menjadi sebab syntax tuh salah.

anyway,saya assume awak nyer database ialah MySQL. lepas nie maybe awak boleh update tajuk nie supaya lebih specific. pastu update to [sOLVED] kalau dah berjaya. Ianya utk kawan2 yg lain jugak. ok.

cuba awak try run this query.

select case_kodsek,concat('Z',substr(case_kodsek,2,length(case_kodsek))) from tmpcase_temp
where substr(case_kodsek,1,1)='W'
dapat tak macam awak nak ? then awak update lar using
update tmpcase_temp 
set  case_kodsek = concat('Z',substr(case_kodsek,2,length(case_kodsek))) 
where substr(case_kodsek,1,1)='W'

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...