Any simple idea to update a column using update query

Posted by Thiru under Sql Server on 9/20/2012 | Points: 10 | Views : 1009 | Status : [Member] | Replies : 2
Hi friends,

any simple idea to update a column (datatype is varchar) using update query:
(note: i need to do using one single update query (NOT USING STORED PROCEDURE))
(i have to apply in mysql database)

existing data is: "555TST"
have to update as: "555PPP"

(i.e: last 3letter shld be changed)
note:number 555 is a running number may go 99999....
and last 3letters is a fixed to 3 letters only

i am trying as:
select Replace("555TST",CONCAT(LEFT("555TST",LENGTH("555TST")-3),"PPP"));

any nice and simple idea.
NOTE: I NEED TO UPDATE THE COLUMN USING UPDATE QUERY




Responses

Posted by: Hariinakoti on: 9/21/2012 [Member] Starter | Points: 25

Up
0
Down
do u want last 3 digits update or entire column update?
please tell me clearly

Thanks & Regards
Hari

Thiru, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Thiru on: 9/21/2012 [Member] Starter | Points: 25

Up
0
Down
Last 3 letters.

i used this update qry:
update tblname set fieldnm=concat(mid(fieldnm,1,length(fieldnm)-3),TargetString)

Thiru, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response