0

How to do the query of "replace 2nd character with * and 4th character with and.

26th Sep 2017, 5:33 AM
Shabana Multani
Shabana Multani - avatar
7 Respuestas
+ 2
Okay, you can try this, but mind that implementation of it depends on which DBMS you are using, and since you did not define a condition, this will update ALL the records, unless you add a WHERE clause. If you use Oracle, replace CONCAT arguments separator to using '||' instead of comma. If you use Ms Sql Server you may opt to combine the arguments using '+' and skip CONCAT all the same. UPDATE employee SET job = CONCAT(SUBSTRING(job,1,1),'*',SUBSTRING(job,3,1),'&',SUBSTRING(job,5)); I'm not on a computer to have the query tested, but I guess you can figure out if something isn't right. Hth, cmiiw
26th Sep 2017, 6:33 AM
Ipang
+ 2
What's the table name, field name and field size? replace the fourth character with 'and' or 'and.' there's a dot character after 'and' in your question title.
26th Sep 2017, 5:56 AM
Ipang
+ 2
Alright, did it work?
26th Sep 2017, 6:55 AM
Ipang
0
it's employee table
26th Sep 2017, 5:57 AM
Shabana Multani
Shabana Multani - avatar
0
I want to replace the 2nd character of job with '*' and 4th character of job with '&' rest of the characters in lower case
26th Sep 2017, 5:59 AM
Shabana Multani
Shabana Multani - avatar
0
thank you so much
26th Sep 2017, 6:54 AM
Shabana Multani
Shabana Multani - avatar
0
ya it was worked.....👍
2nd Oct 2017, 8:23 PM
Shabana Multani
Shabana Multani - avatar